小编PP0*_*006的帖子

如何在 ARM 模板中检索 Application Insight(驻留在另一个资源组中)的检测密钥?

有没有办法在 ARM 模板中检索 Application Insights(驻留在另一个资源组中)的仪器密钥?

我已经使用以下代码使用 ARM 模板创建了一个 appInsights,

{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "AppInsightsName": { "type": "string" },
    "Location": { "type": "string", "defaultValue": "westeurope" }
  },
  "variables": {
    //"apiVersion": "2018-02-01-preview",
    "apiVersion": "2016-08-01",
    "location": "[parameters('Location')]",
    "ApplicationInsightsName": "[parameters('AppInsightsName')]"
  },
  "resources": [
    {
      "apiVersion": "2014-04-01",
      "type": "Microsoft.Insights/components",
      "name": "[variables('ApplicationInsightsName')]",
      "location": "[variables('location')]",
      "kind": "other",
      "properties": {
        "applicationId": "[variables('ApplicationInsightsName')]"
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

现在我尝试将在另一个资源组中运行的 azure 函数应用程序与此 appInsights 链接。

下面是我尝试过的代码,

{
  "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
  "value": "[reference(resourceId(variables('AppInsightsResourceGroup'),'Microsoft.Insights/components', variables('ApplicationInsightsName'))).InstrumentationKey]"
}
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误,

在此输入图像描述

有人可以提供一些如何破解这个的想法吗?

azure azure-resource-manager azure-application-insights azure-rm-template

8
推荐指数
1
解决办法
3115
查看次数