为 Application Insights 高级层配置部署模板

Configure deployment template for application insights premium teir

这是我的应用程序洞察部署模板部分。有用。但我想部署到不同的定价 tier\quota。什么是正确的参数?

 {
  "apiVersion": "2014-04-01",
  "name": "[parameters('siteName')]",
  "type": "Microsoft.Insights/components",
  "location": "Central US",
  "dependsOn": [
    "[concat('Microsoft.Web/sites/', parameters('siteName'))]"
  ],
  "tags": {
    "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]": "Resource"
  },
  "properties": {
    "ApplicationId": "[parameters('siteName')]",
    "sku": "Premium"
  }

您可以在部署模板中定义一个 "sku" 参数,并将其用作控制 AI 资源定价层的参数。

您的 "serverFarm" 资源类型将使用 "sku" 参数来确定您的资源在托管计划下的应用服务托管计划层级。

"parameters": {
        "sku": {
            "type": "string",
            "allowedValues": [
                "Free",
                "Shared",
                "Basic",
                "Standard",
                "Premium"
            ],
            "defaultValue": "Premium"
        }
}

    {
        "type": "Microsoft.Web/serverfarms",
        "name": "[parameters('hostingPlanName')]",
        "apiVersion": "2015-08-01",
        "sku": {
            "name":  "P1",
            "tier": "[parameters('sku')]"
        },
        "properties": {
            "numberOfWorkers": "[parameters('numOfWorkers')]",
            "workerSize": "[parameters('workerSize')]"
        },
        "location": "[resourceGroup().location]"
    }

{
  "apiVersion": "2014-04-01",
  "name": "[parameters('siteName')]",
  "type": "Microsoft.Insights/components",
  "location": "Central US",
  "dependsOn": [
    "[concat('Microsoft.Web/sites/', parameters('siteName'))]"
  ],
  "tags": {
    "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]": "Resource"
  },
  "properties": {
    "applicationId": "[parameters('siteName')]"
  }

更新 1:

基于 Microsoft Application Insight 的最新 ARM 模板架构,您无法为其定义层 属性。

正如我之前强调的那样,该层仅为 "serverFarm" 或更广为人知的 App Service Hosting Plan 资源定义。

参考:azure-resource-manager-schemas/schemas/2014-04-01/Microsoft.Insights.json

"components": {
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "Microsoft.Insights/components"
          ]
        },
        "apiVersion": {
          "enum": [
            "2014-04-01"
          ]
        },
        "properties": {
          "type": "object",
          "properties": {
            "applicationId": {
              "type": "string",
              "minLength": 1,
              "description": "Microsoft.Insights/components: applicationId"
            }
          }
        }
      },
      "required": [
        "type",
        "apiVersion",
        "properties",
        "location"
      ],
      "description": "Microsoft.Insights/components"
    }

您现在可以通过 ARM 模板为应用洞察设置定价层和配额。

https://docs.microsoft.com/en-us/azure/application-insights/app-insights-powershell#create-an-azure-resource-manager-template