Search code examples
azure-devopsazure-pipelines

Why is Azure DevOps Services task group command interpreted as a task group variable?


The following command (point 2) $vm = az vm show --resource-group "$resourceGroupName" --name $vmName --query "id" --output tsv is interpreted as a task group parameter, and automatically displayed on task group parameters (point 1).

I can't remove it as a parameter.

enter image description here

Why does this happen? How to prevent it?


Solution

  • My first impression is that you have somewhere in the script an Azure CLI command like this:

    $vm = $(az vm show ...)
    

    $(xxx) is the syntax to reference a pipeline variable. Task groups will automatically add a parameter for any string that is found between $( and ), such as $(az vm show ...):

    Reproducing the issue

    I just created a dummy task group with an Azure CLI task:

    Task group - Azure CLI task

    The following parameters were added automatically to the task group:

    Task group - parameters

    Workaround

    Remove the $( and ) from the Azure CLI command if possible and then save the task group.