azure - 为什么自动发布后需要手动开启应用洞察?
问题描述
为什么应用洞察在发布后没有自动开启?
执行自动发布后,在门户中导航到应用程序洞察时我得到了这个:
以下是我在 ARM 模板中的定义:
{
"type": "microsoft.insights/components",
"kind": "web",
"name": "[parameters('webAppName')]",
"apiVersion": "2015-05-01",
"location": "[parameters('location')]",
"tags": {
"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('webAppName'))]": "Resource",
"displayName": "[parameters('webAppName')]"
},
"properties": {
"Application_Type": "web"
},
"dependsOn": []
}
我究竟做错了什么?为什么没有自动打开应用洞察?
请注意,我添加了以下 appsettings:
解决方案
为了让 Azure 门户显示与 Application Insights 的主动集成,您需要设置三个应用设置。原因是您还需要配置 Application Insights Agent Extension。
请注意,设置 InstrumentationKey 可能足以让您的应用程序将遥测数据发送到 ApplicationInsights,例如,如果您使用 ASP.NET Core 和相应的 Nuget 包。但是您将需要所有三个门户才能显示活动集成。
{
"resources": [
{
"name": "[parameters('name')]",
"type": "Microsoft.Web/sites",
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference('microsoft.insights/components/AppMonitoredSite', '2015-05-01').InstrumentationKey]"
},
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[reference('microsoft.insights/components/AppMonitoredSite', '2015-05-01').ConnectionString]"
},
{
"name": "ApplicationInsightsAgent_EXTENSION_VERSION",
"value": "~2"
}
]
},
"name": "[parameters('name')]",
"serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
"hostingEnvironment": "[parameters('hostingEnvironment')]"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
"microsoft.insights/components/AppMonitoredSite"
],
"apiVersion": "2016-03-01",
"location": "[parameters('location')]"
},
{
"apiVersion": "2016-09-01",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('location')]",
"properties": {
"name": "[parameters('hostingPlanName')]",
"workerSizeId": "[parameters('workerSize')]",
"numberOfWorkers": "1",
"hostingEnvironment": "[parameters('hostingEnvironment')]"
},
"sku": {
"Tier": "[parameters('sku')]",
"Name": "[parameters('skuCode')]"
}
},
{
"apiVersion": "2015-05-01",
"name": "AppMonitoredSite",
"type": "microsoft.insights/components",
"location": "West US 2",
"properties": {
"ApplicationId": "[parameters('name')]",
"Request_Source": "IbizaWebAppExtensionCreate"
}
}
],
"parameters": {
"name": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"hostingEnvironment": {
"type": "string"
},
"location": {
"type": "string"
},
"sku": {
"type": "string"
},
"skuCode": {
"type": "string"
},
"workerSize": {
"type": "string"
},
"serverFarmResourceGroup": {
"type": "string"
},
"subscriptionId": {
"type": "string"
}
},
"$schema": "https://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0"
}
另请参阅我的其他答案:Azure Cli How to enable Application Insights for webapp
推荐阅读
- c++ - 如何拒绝不是数字的输入?
- python - 我想在另一个函数中使用一个函数的返回值,而无需再次运行该函数。(Python)
- stata - 循环遍历名称中具有相同前缀的许多变量
- python - Pandas:TypeError:列表索引必须是整数或切片,而不是 DataFrame
- pagination - 使用 Azure 数据工厂从 HubSpot REST api 获取数据 - 所有联系人(分页)
- python - 如何获取和解码发往特定端口的消息
- sql-server - 用户“域\用户”登录失败。原因:试图将 NT 帐户名用于 SQL Server 身份验证。[客户:
] - java - 用指数符号Java解析复数
- pandas-groupby - 按日期计数的 Pandas 列
- php - 无法在PHP中移动文件夹中的文件