I have an azure-pipelines.yml file at the root of my project in git. In this file I would like to use the output from one task in the next task, as a variable. My task
- task: AzureCLI@2
displayName: 'List info on read policy in DEV'
name: myOutput
inputs:
azureSubscription: mySub
scriptType: ps
scriptLocation: inlineScript
inlineScript: az servicebus topic authorization-rule keys list --resource-group myRG --namespace-name mySB --topic-name myTopic --name Listen
When running this az command in powershell i get this in return:
{
"aliasPrimaryConnectionString": null,
"aliasSecondaryConnectionString": null,
"keyName": "Listen",
"primaryConnectionString": "Endpoint=sb://someKey",
"primaryKey": "somePrimaryKey",
"secondaryConnectionString": "Endpoint=sb://another key",
"secondaryKey": "someSecondaryKey"
}
I do get this output in the logs in the pipeline as well. I did expect, according to documentation to be able to use this in the next step. For example:
- script: echo $(myOutput.primaryConnectionString)
Instead of getting the value of the primaryConnectionString this is what the log gives me:
Starting: CmdLine
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.151.2
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
Script contents:
echo $(myOutput.primaryConnectionString)
========================== Starting Command Output ===========================
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a\_temp\3d1130bd-f7f7-4e30-8ae2-31e6f9d0800e.cmd""
$(myOutput.primaryConnectionString)
Finishing: CmdLine
Why is the variable name not replaced with the value of primaryConnectionString?