2015-10-20 1 views
2

Im пытается подключить наш сайт к компоненту Application Insights через ARM, но при этом возникает проблема с настройкой ключа Intstrumentation в качестве настройки веб-приложения. Это работает иногда, а иногда и нет.DependsOn Неудача в шаблоне ARM

Я предполагаю, что у меня есть неправильные параметры зависимости. Может ли кто-нибудь взглянуть на мой шаблон и посмотреть, делает ли он что-то не так? Посмотрите на ресурс под названием «appSettings» типа «config» на ресурсе веб-сайта. Здесь я должен ждать завершения Application Insight, а затем прочитать Ключ Instrumentation.

{ 
    "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')]" 
    } 
}, 

Лучшие reagards Никлас

+0

Каково поведение, когда оно не работает? Любые ошибки? – BenV

+0

Привет, Бен, поведение заключается в том, что appsetting im пытается установить, «ApplicationInsights.InstrumentationKey» не установлен на всех. Веб-сайт создается без этого ключа/значения. –

+0

Я испытываю подобные проблемы, любые обновления по этой проблеме? – Marko

ответ

0

Вы пытались поместить dependsOn внутри декларации понимание ресурсов?

Посмотрите на шаблон Quickstart для веб + SQL здесь: https://github.com/Azure/azure-quickstart-templates/blob/master/201-web-app-sql-database/azuredeploy.json

Они разместили dependsOn на декларации Insight и ничего об объявлении сайта. Будет ли это работать на вас?

{ 
     "apiVersion": "2015-05-01", 
     "name": "[concat('AppInsights', variables('webSiteName'))]", 
     "type": "Microsoft.Insights/components", 
     "location": "centralus", 
     "dependsOn": [ 
     "[variables('webSiteName')]" 
     ], 
     "tags": { 
     "[concat('hidden-link:', resourceId('Microsoft.Web/sites', variables('webSiteName')))]": "Resource", 
     "displayName": "AppInsightsComponent" 
     }, 
     "properties": { 
     "ApplicationId": "[variables('webSiteName')]" 
     } 
    } 

 Смежные вопросы

  • Нет связанных вопросов^_^