3

For years we stored our environment variables in devops pipelines (for each environment) and had a custom powershell script for updating them on deploy.

enter image description here

recently on another project with similar need, I discovered that the task Àzure App Service Deploy had an app settings section, great. seems to be exactly what is needed to get rid of our powershell custom script.

however I didn't found (official documentation of the task doesn't mention it) how to re-use pipeline variables into task app settings. any idea if it's possible ?

enter image description here

1
  • 1
    Refer to the variables the same way you do in every other context: $(VariableName) Commented Nov 17, 2019 at 16:36

1 Answer 1

6

At the pipeline Variables you have to set your variables. Variables tab will look like: Variables tab

Once the variables are set you can use them at your release pipeline under Deploy Azure App Service task in format -key value. As per documentation:

Edit web app Application settings using the syntax -key value. Values containing spaces must be enclosed in double quotes. Examples: -Port 5000 -RequestTimeout 5000 and -WEBSITE_TIME_ZONE "Eastern Standard Time".

As you have values set the format will be -key $(VariableName). This format should be familiar as pipelines refer to release default variables.

So your App settings at Deploy Azure App Service task will look like

-Key1 $(Variable1) -Key2 $(Variable2)

or:

enter image description here

To reuse same variables over the pipelines you can setup Variable Group.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.