0

我有一个用于应用服务计划的自动扩展属性的 ARM 模板。目前只有一个默认配置文件。我想在默认配置文件中再添加一个配置文件。但它在通过 VSTS 部署时给了我错误。它允许我通过门户手动添加。

我们如何在 ARM 模板中添加多个配置文件?

下面的代码片段。

 {
  "type": "Microsoft.Web/serverfarms",
  "sku": {
    "name": "S1",
    "tier": "Standard",
    "size": "S1",
    "family": "S",
    "capacity": 1
  },
  "kind": "app",
  "name": "[variables('ServerFarm_gateway_name')]",
  "apiVersion": "2016-09-01",
  "location": "[resourceGroup().location]",
  "resources": [
    {
      "type": "Microsoft.Insights/autoscaleSettings",
      "name": "[concat(variables('ServerFarm_gateway_name'),'-autoscaleout')]",
      "apiVersion": "2015-04-01",
      "location": "[resourceGroup().location]",
      "properties": {
        "profiles": [
          {
            "name": "Default",
            "capacity": {
              "minimum": "1",
              "maximum": "5",
              "default": "1"
            },
            "rules": [
              {
                "scaleAction": {
                  "direction": "Increase",
                  "type": "ChangeCount",
                  "value": "1",
                  "cooldown": "PT10M" 
                },
                "metricTrigger": {
                  "metricName": "dependencies/duration",
                  "metricNamespace": "microsoft.insights/components/kusto",
                  "metricResourceUri": "[resourceId('Microsoft.Insights/components', variables('AppInsights_Name'))]",
                  "operator": "LessThan",
                  "statistic": "Average",
                  "threshold": 3000,
                  "timeAggregation": "Average",
                  "timeGrain": "PT1M",
                  "timeWindow": "PT5M",
                  "Dimensions": [],
                  "dividePerInstance": false
                }
              }
            ]
          },
          {
            "name": "Auto created scale condition",
            "capacity": {
              "minimum": "1",
              "maximum": "5",
              "default": "1"
            },
            "rules": [
              {
                "scaleAction": {
                  "direction": "Decrease",
                  "type": "ChangeCount",
                  "value": "1",
                  "cooldown": "PT10M"
                },
                "metricTrigger": {
                  "metricName": "dependencies/duration",
                  "metricNamespace": "microsoft.insights/components/kusto",
                  "metricResourceUri": "[resourceId('Microsoft.Insights/components', variables('AppInsights_Name'))]",
                  "operator": "LessThan",
                  "statistic": "Average",
                  "threshold": 3000,
                  "timeAggregation": "Average",
                  "timeGrain": "PT1M",
                  "timeWindow": "PT5M",
                  "Dimensions": [],
                  "dividePerInstance": false
                },
                "recurrence": {
                  "frequency": "Week",
                  "schedule": {
                    "timeZone": "W. Europe Standard Time",
                    "days": [
                      "Monday",
                      "Tuesday",
                      "Wednesday",
                      "Thursday",
                      "Friday",
                      "Saturday",
                      "Sunday"
                    ],
                    "hours": [
                      0
                    ],
                    "minutes": [
                      0
                    ]
                  }
                }
              }
            ]
          }
        ],
        "enabled": true,
        "targetResourceUri": "[resourceId('Microsoft.Web/serverfarms', variables('ServerFarm_gateway_name'))]"
      },
      "dependsOn": [
        "[concat('Microsoft.Web/serverfarms/', variables('ServerFarm_gateway_name'))]"
      ]
    }
  ],
  "dependsOn": []
}

部署后报错:

[error]BadRequest: {
  "code": "MultipleDefaultProfiles",
  "message": "The autoscale setting that you provided has '2' default profiles, you can only specify one default profile per setting."
}
4

1 回答 1

0

由于第一个配置文件既不是固定日期也不是重复的,因此 Autoscale 运行始终为一个的常规配置文件。这就是我收到这样的错误的原因。现在我将重复配置文件移动到第一个然后另一个。现在两者都运行良好。

于 2020-01-29T14:02:42.757 回答