azure-devopsazure-pipelinesazure-task-groups

Can I restore a deleted Task Group in Azure Devops (VSTS)?


I accidentally deleted a Task Group but I need it and I would like to restore it.

Is there any way that a deleted Task Group could be restored in Azure DevOps (VSTS)?

I see in the documentation that deleted Build Definitions can be restored but I found nothing about deleted Task Groups.


Solution

  • There is certainly a workaround to restore the task group, and that is creating an identical one and replacing all the references to point to the newly created task group.

    For that, first you need the GUID of the deleted task group. You can get it easily from a pipeline referencing it: missingTaskGroup

    Just go to the history tab of the given pipeline and look for the deleted task group and its GUID in the YAML after opening one of the versions using "Compare Difference".

    You should find something like this, where id is the GUID of the task group:

    "steps": [
          {
            "environment": {},
            "enabled": true,
            "continueOnError": true,
            "alwaysRun": true,
            "displayName": "Task group: testTaskGroup ",
            "timeoutInMinutes": 0,
            "condition": "succeededOrFailed()",
            "task": {
              "id": "5e417q45-afea-4f74-a126-a26ea17020dc",
              "versionSpec": "1.*",
              "definitionType": "metaTask"
            },
            "inputs": {}
          }
    

    Replacing the placeholders in the following URL and navigating to it should let you retrieve the full history of the deleted task group: https://dev.azure.com/[yourOrganization]/[yourProject]/_taskgroup/[taskGroupGuid]

    After switching to the History tab, you can just save the JSON of the version you prefer and use the Import feature in the Taskgroups page to create a new, but identical task group as the deleted one.