Azure resource manager template website app settings

Damien Pontifex picture Damien Pontifex · Dec 22, 2014 · Viewed 10.4k times · Source

I am trying to add app settings to my Azure Website via the JSON template files as part of the Azure Resource Manager.

In an Azure Resource template json file, there are examples for creating connectionStrings directly from the JSON template file with a sub-dependency of type 'config' with properties for 'connectionStrings' as in the final example here http://haishibai.blogspot.co.uk/2014/09/tutorial-building-azure-template.html I have also checked in the website schema definition for websites here http://schema.management.azure.com/schemas/2014-06-01/Microsoft.Web.json#/definitions/sites and cannot see that it is possible.

Is it possible to define a websites app settings for resource manager deployments from the JSON template file? And if so any links or details would be greatly appreciated.

(I have already tried properties of appSettings inside the config resource and inside the website resource)

Answer

David Ebbo picture David Ebbo · Dec 23, 2014

I have a sample that shows how to do this here. It looks like this:

    {
      "apiVersion": "2014-11-01",
      "name": "appsettings",
      "type": "config",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
      ],
      "properties": {
        "AppSettingKey1": "Some value",
        "AppSettingKey2": "My second setting",
        "AppSettingKey3": "My third setting"
      }
    }

Please make sure you use the newest 2014-11-01 API, as the way it deals with app settings is a bit different from the older API.