Set Output Variable in Azure CLI task on VSTS

前端 未结 4 1402
终归单人心
终归单人心 2020-12-07 01:48

I am getting crazy to achieve this very simple task. I need to set an Output Variable in an Azure CLI task on Visual Studio Team Services, because next task in the Release d

4条回答
  •  有刺的猬
    2020-12-07 02:52

    Inspired from the answer above but with some variation.

    Works in an Azure CLI task on a Hosted Ubuntu agent in Microsoft DevOps as of July 2019.

    This example runs an az command to fetch the full resource name of a storage account and sets it in the variable _StorageAccountNameVar for use in another pipeline task.

    myvar=`az storage account list -g MyResourceGroup --query "[?contains(name, 'config')].name" -o tsv`
    echo $myvar
    echo "##vso[task.setvariable variable=_StorageAccountNameVar;]$myvar"
    

提交回复
热议问题