Press "Enter" to skip to content

Appsettings not present after ARM deployment

Within the config section of an App Service you are able to define multiple sections.
In this example we are using three sections : web, appsettings and logs.

Since we noticed that sometimes the expected settings were not configured/missing after
a deployment we figured out some missing dependsOn settings need to be set.

Please note that in the ARM snippet below the appsettings depend on the
web settings to be processed. Subsequently the log settings depend on the appsettings to
be processed.

After applying the additional rules we have not seen this behavior again.

Click ARM Snippet button to expand code:

{
  "name": "[variables('ExampleAppName')]",
  "type": "Microsoft.Web/sites",
  "location": "[resourceGroup().location]",
  "apiVersion": "2015-08-01",
  "kind": "api",
  "dependsOn": [
  "[resourceId('Microsoft.Web/serverfarms', variables('applicationPlanName'))]"
],
  "tags": {
  "displayName": "Example App"
},
  "properties": {
  "name": "[variables('ExampleAppName')]",
  "serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', variables('applicationPlanName'))]",
  "clientAffinityEnabled": "false"
},
  "resources": [{
    "name": "web",
    "type": "config",
    "apiVersion": "2015-08-01",
    "dependsOn": [
     "[resourceId('Microsoft.Web/sites', variables('ExampleAppName'))]"
],
  "tags": {
    "displayName": "webconfig Example App"
},
  "properties": {
  "alwaysOn": "true"
}
},
{
  "apiVersion": "2015-08-01",
  "name": "appsettings",
  "type": "config",
  "dependsOn": [
    "[resourceId('Microsoft.Web/sites', variables('ExampleAppName'))]",
    "[resourceId('Microsoft.Web/sites/config', variables('ExampleAppName'), 'web')]"
],
  "tags": {
  "displayName": "appsettings Example App"
},
  "properties": {
    "EXAMPLE1": "[parameters('EXAMPLE1')]",
    "EXAMPLE2": "[parameters('EXAMPLE2')]"
}
},
{
  "name": "logs",
  "type": "config",
  "apiVersion": "2015-08-01",
  "dependsOn": [
    "[concat('Microsoft.Web/sites/', variables('ExampleAppName'))]",
    "[resourceId('Microsoft.Web/sites/config', variables('ExampleAppName'), 'appsettings')]"
],
  "tags": {
  "displayName": "logs Example App"
},
  "properties": {
   "applicationLogs": {
    "fileSystem": {
     "level": "Warning"
}
},
  "httpLogs": {
   "fileSystem": {
    "retentionInMb": "35",
    "enabled": true
}
},
  "detailedErrorMessages": {
    "enabled": false
}
}
}
]
}

ARM Snippet






One Comment

  1. Daniel Daniel

    Hi Bram,

    I´m very glad that i found your post on this issue! I was in contact with MS support because of this issue where the arm template deploy did not update the appsettings (In production, yay). But they where clueless. So I googled my way here, and after reading your post it makes total sense that the web needs to be deploy before the appsettings resource.

    Thank you for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.