首页 > 解决方案 > 如何使用 ARM 模板为注释创建 Application Insights API 密钥

问题描述

我正在尝试从 ARM 模板创建 Application Insights API 密钥。我需要在资源部署期间创建用于编写注释的 API 密钥,以便在 Azure Devops 的应用程序部署期间发布注释正常工作。

我试图找到有关如何使其工作的信息,但我只能找到有关如何使用 PowerShell 或 Azure REST API 创建密钥的示例。

我需要做的是使用 ARM 模板创建 API 密钥。我已经尝试过无数次与此类似的 json 尝试,但均未成功;

 {
  "name": "[variables('applicationInsightsName')]",
  "type": "Microsoft.Insights/components",
  "location": "[resourceGroup().location]",
  "apiVersion": "2014-04-01",
  "tags": {
    "displayName": "[concat('Component ', variables('applicationInsightsName'))]"
  },
  "properties": {
    "applicationId": "[variables('applicationInsightsName')]"
  },
  "resources": [
    {
      "name": "action",
      "type": "apikeys",
      "location": "[resourceGroup().location]",
      "apiVersion": "2015-05-01",
      "properties": {
        "name": "Azure Devops Release Annotations",
        "linkedWriteProperties": [
          "[concat(resourceId('Microsoft.Insights/components', variables('applicationName')), '/annotations')]"
        ],
        "linkedReadProperties": []
      },
      "dependsOn": [
        "[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]"
      ]
    }
  ]
}

到目前为止,我发现的最好的信息是 this,但这并没有多大帮助。

是否可以使用 ARM 模板创建 API 密钥?

标签: azureazure-application-insightsazure-resource-managerarm-template

解决方案


不,这是不可能的,ARM 模板仅模拟PUT请求,而Microsoft.Insights/Components/ApiKeys/ActionPOST请求。


推荐阅读