Home > Net >  How to use variable in Azure CLI script within Devops release Pipeline
How to use variable in Azure CLI script within Devops release Pipeline

Time:12-06

I am trying to pass the below variable to a inline script in the Azure CLI Job in Azure release Pipelines, to get the principal ID of an identity:

miid=$(az identity show -g Resourcegroup -n prodaks-agentpool --query "principalId" -o tsv)

I am then running the below commands to set a policy in keyvault for the identity.

call az keyvault set-policy -n proddigitalkeyvault1 --key-permissions get --object-id $miid
call az keyvault set-policy -n proddigitalkeyvault1 --secret-permission get --object-id $miid
call az keyvault set-policy -n proddigitalkeyvault1 --certificate-permissions get --object-id $miid

I receive the error: "miid is not recognized as an internal command". Is it possible to add this variable into the inline script? This script works fine when running from my own machine.

CodePudding user response:

I switched my type of script to shell and removed the "call" command. This script now runs ok in Azure Devops

  • Related