Search code examples
azureazure-devopsazure-web-app-servicecicd

How to get value from Azure App Service from Azure pipeline


I have a configuration in App Service like this enter image description here I want to pass this setting into the argument of a pipeline's task enter image description here How can I do it?

I've tried to create a variable group but I still don't know how to link the app setting into the variable enter image description here


Solution

  • Microsoft provide command line tools to access this information. I don't have a web-app to access to give specific commands but roughly something like this.

    See documentation here: https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=cli#configure-app-settings

    For example using az cli you could do something like:

    az webapp config connection-string list --resource-group <group-name> --name <app-name> > settings.json

    You can then select the specific item out of that list using jq.

    myvalue=$(jq -r .some.path settings.json)

    And you can also set the value in a variable which you can use in another task:

    ##vso[task.setvariable variable=appsetting;]value

    So :

    1. Download app settings
    2. Select item
    3. Set variable to pass to next step
    4. Use variable in next step.