Reputation: 1000
For years we stored our environment variables in devops pipelines (for each environment) and had a custom powershell script for updating them on deploy.
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 ?
Upvotes: 3
Views: 5128
Reputation: 3256
At the pipeline Variables
you have to set your variables. Variables tab will look like:
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:
To reuse same variables over the pipelines you can setup Variable Group.
Upvotes: 6