azure 为什么在自动发布后需要手动打开应用洞察?

6psbrbz9  于 2022-12-14  发布在  其他
关注(0)|答案(2)|浏览(132)

为什么应用洞察在发布后不自动打开?

在执行自动发布后,我在门户中导航到应用洞察时看到:

下面是我在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": []
}

我做错了什么?为什么没有自动打开应用洞察?
请注意,我添加了以下应用程序设置:

mzsu5hc0

mzsu5hc01#

为了使Azure门户显示与Application Insights的活动集成,你需要设置 * 两个 * 应用设置。原因是你还需要配置Application Insights代理扩展。
请注意,设置InstrumentationKey(已弃用)或连接字符串可能足以让应用程序将遥测发送到ApplicationInsights,例如,如果您使用的是ASP.NET Core和相应的Nuget包。但您需要这两个设置,门户才能显示活动的集成。

{
    "resources": [
        {
            "name": "[parameters('name')]",
            "type": "Microsoft.Web/sites",
            "properties": {
                "siteConfig": {
                    "appSettings": [
                        {
                            "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如何为Web应用启用应用洞察
编辑:根据BearOakheart回答中的新信息更新。

wixjitnu

wixjitnu2#

接受的答案已过期。不建议将APPINSIGHTS_INSTRUMENTATIONKEY与APPLICATIONINSIGHTS_CONNECTION_STRING一起使用。最后提供的答案将获胜。
不建议使用instrumentation密钥,我们应改用APPLICATIONINSIGHTS_CONNECTION_STRING。
否则提供的答案为真。更多信息请访问:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/migrate-from-instrumentation-keys-to-connection-strings

相关问题