Azure app settings task in Azure pipeline throws invalid JSON error when supplying with variable

SHEHUL PATEL 21 Reputation points

Trying to update Azure Configuration using Azure Pipeline's Azure App Settings task as documented here:

The link has a sample for appsettings as,

appSettings: |  
          "value": "$(Key)",  
          "slotSetting": false  
          "name": "MYSQL_DATABASE_NAME",  
          "value": "$(DB_Name)",   
          "slotSetting": false  

However when we try to supply the same with a variable like this,

- task: AzureAppServiceSettings@1  
    displayName: Azure App Service Settings  
        azureSubscription: $(subscriptionName)  
        appName: $(appServiceName)    
        resourceGroupName: $(resourceGroupName)         
        appSettings: $env:azureConfigurationSettings  

we receive error as

##[error]Error: Application Settings object is not a valid JSON.  

I have verified $env:azureConfigurationSettings is correct JSON via JSON validator as well as it successfully parses JSON.Parse(theActualValue).
When we put the actual value of variable as hardcoded string there is no error and the configuration gets updated.

Need help in determining,

  1. If this Azure appsettings task supports the supply of variable and if it does, what is the correct syntax. The variable is coming from Powershell script.

I looked at the source code at

and logically I think it should work.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,918 questions
{count} votes

Accepted answer
  1. MayankBargali-MSFT 68,396 Reputation points


    Welcome to Microsoft Q&A! Thanks for posting the question.

    DevOps is currently not supported in the Q&A forums, the supported products are listed over here (more to be added later on).

    You can ask the experts in the dedicated forum over here:

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

0 additional answers

Sort by: Most helpful