0

I have the following code that creates the environment variable called ENDPOINT_TEST through an ADO pipeline but I want to hide the URL https://xyz. I have created a secret in the keyvault to store this url as secret_url and I have linked my keyvault variables with ADO. My question is how can I call this variable from ADO and use it in this azure cli script?

- task: AzureCLI@1
   displayName: 'Set variable'
   inputs: 
     azureSubscription: 'test-group-SPN'
     scriptType: 'ps'
     scriptLocation: 'inlineScript'
     inlineScript: |
            az webapp config appsettings set -n function-test -g test-group --settings ENDPOINT_TEST=https://xyz

I have tried the following:

az webapp config appsettings set -n function-test -g test-group --settings ENDPOINT_TEST=$(secret_url)

az webapp config appsettings set -n function-test -g test-group --settings ENDPOINT_TEST='$(secret_url)'

az webapp config appsettings set -n function-test -g test-group --settings ENDPOINT_TEST=${secret_url}

None of these have worked. What am I missing? Any help or suggestion is appreciated!

abautista
  • 2,410
  • 5
  • 41
  • 72

1 Answers1

0

Azure DevOPS Pipeline can store the string securely, under the hood it uses the same mechanism. Once you store the variable as secure string, the value of it cannot be reveal.

If feel pipeline variable is make this process simplify. Make sure while creating it "Keep this value as secret"

Here is the reference https://www.benday.com/2021/07/20/azure-devops-yaml-pipelines-how-to-set-an-environment-variable-during-a-build-or-release/