azurepowershellazure-devopsoutput-parameter

Unable to use output variables from a PowerShell script in the Override Parameters of a Resource Group deployment task in Azure DevOPS


I have a PowerShell script where I have multiple output variables generated with the following syntax :

Write-Host ("##vso[task.setvariable variable=appObjectId;issecret=false]"+$appObjectId)

In the PowerShell task in Azure DevOPS, I have set the Output variables as follow: enter image description here

Then, I use my output variables in an Azure Resource Group deployment as follow: enter image description here

Unfortunately, when I look into the deployment details in Azure, I can see that the parameters of my ARM are not filled out with the value of the output parameters but with the name of it: enter image description here

Important information: the ARM deployment task is done inside a task group. My PowerShell script is in the pipeline, just before the call to the Task Group. I tried to put the script inside the Task Group but I have the exact same issue.


Solution

  • I found the root cause: I need to enclose the parameter "$(myParam)" in the tasks where I need to use it. Otherwise, it is not computed.