linlin
linlin

Reputation: 61

How to update azure appsettings with arm template

I have an Azure API app service with 30+ appsettings in its configuration. This app service is deployed in 3 environments, where some appsettings are universal across the environments, and other settings are environment-specific. We are using Devops CD pipeline to deploy to the different environments.

Right now the settings are manually created/updated in the app portal. But I would like to have the settings as part of the deployment - either in the source files or the devops CD pipeline.

I know that Devops have a "Azure App Service Settings" task, which does exactly what I want - But there is a limit of 5000 characters in its app-settings slot, so I would have to add several tasks for this, which quickly becomes unmanagable (lots of digging to find a particular setting).

Is it possible to use arm template for app settings? Or maybe there is another way to do this?

Upvotes: 2

Views: 2215

Answers (1)

linlin
linlin

Reputation: 61

I finally found the correct "kind" needed for the template (I thought it was a bit difficult to find documentation, cause I kept ending up on web-app documentation instead of api app):

"resources": [
{
  "type": "Microsoft.Web/sites/slots",
  "apiVersion": "2018-11-01",
  "name": "[parameters('MyAppName']",
  "location": "West Europe",
  "kind": "api",
  "properties": {
    "siteConfig": {
      "appSettings": [
        {
          "name": "Setting1",
          "value": "Setting1Value"
        }
      ]
    }
  }
}

]

I then use Devops to set the parameter values for each environment

Upvotes: 3

Related Questions