Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DependsOn Failing in ARM Template

Im trying to connect our website to a Application Insights component via ARM but havning troubles in setting the Intstrumentation Key as an website application setting. This works sometimes and sometimes not.

My guess is that i m having incorrect dependsOn settings. Can anyone have a look on my template and see if i m doing something wrong? Have a look on the resource called "appSettings" of type "config" in the website resource. Here I am supposed to wait for completion of the Application Insight and then read the Instrumentation Key.

 {
  "name": "[variables('webAppNameFinal')]",
  "type": "Microsoft.Web/sites",
  "location": "[parameters('appServicePlanLocation')]",
  "apiVersion": "2015-04-01",
  "dependsOn": [
    "[concat('Microsoft.Web/serverfarms/', variables('appServicePlanNameFinal'))]"
  ],
  "tags": {
    "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanNameFinal'))]": "Resource",
    "displayName": "webApp"
  },
  "properties": {
    "name": "[variables('webAppNameFinal')]",
    "serverFarmId": "[variables('appServicePlanNameFinal')]"
  },
  "resources": [
    {
      "apiVersion": "2015-04-01",
      "name": "connectionstrings",
      "type": "config",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', variables('webAppNameFinal'))]",
        "[resourceId('Microsoft.Sql/servers', variables('sqlServerNameFinal'))]"
      ],
      "properties": {
        "Watches": {
          "value": "[concat('Server=tcp:', reference(concat('Microsoft.Sql/servers/', variables('sqlServerNameFinal'))).fullyQualifiedDomainName, ',1433;Database=', variables('sqlDatabaseNameFinal'), ';User ID=', parameters('sqlServerAdminLogin'), ';Password=', parameters('sqlServerAdminLoginPassword'), ';Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;')]",
          "type": "SQLAzure"
        }
      }
    },
    {
      "apiVersion": "2015-08-01",
      "name": "appsettings",
      "type": "config",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', variables('webAppNameFinal'))]",
        "[concat('Microsoft.Insights/components/', variables('applicationInsightsNameFinal'))]"
      ],
      "properties": {
        "Watches.Webjobs.VitecConnect.WatchersExport.Run": "false",
        "ApplicationInsights.InstrumentationKey": "[reference(concat('Microsoft.Insights/components/', variables('applicationInsightsNameFinal'))).InstrumentationKey]"
      }
    },
    {
      "apiVersion": "2015-04-01",
      "name": "web",
      "type": "sourcecontrols",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', variables('webAppNameFinal'))]"
      ],
      "properties": {
        "RepoUrl": "[parameters('gitUrl')]",
        "branch": "[parameters('gitBranch')]"
      }
    },
    {
      "apiVersion": "2015-08-01",
      "name": "web",
      "type": "config",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', variables('webAppNameFinal'))]"
      ],
      "properties": "[variables('siteProperties')]"
    }
  ]
},
{
  "name": "[variables('applicationInsightsNameFinal')]",
  "type": "Microsoft.Insights/components",
  "location": "Central US",
  "apiVersion": "2014-04-01",
  "dependsOn": [ ],
  "tags": {
    "displayName": "Application Insights"
  },
  "properties": {
    "applicationId": "[variables('webAppNameFinal')]"
  }
},