ARM 模板 - AlertRules - UnsupporedMetric

ARM Template - AlertRules - UnsupporedMetric

我正在尝试创建一个 ARM 模板以将警报指标添加到我的弹性池数据库中。我已在门户中手动完成此操作,并使用从门户生成的 ARM 模板。

这是 ARM 模板:

    {
  "type": "microsoft.insights/alertrules",
  "name": "[parameters('alertrules_dtu_name')]",
  "apiVersion": "2014-04-01",
  "location": "westus",
  "tags": {
    "hidden-link:/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Sql/servers/xxx/elasticPools/ElasticPool1": "Resource"
  },
  "scale": null,
  "properties": {
    "name": "[parameters('alertrules_dtu_name')]",
    "description": "",
    "isEnabled": true,
    "condition": {
      "odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
      "dataSource": {
        "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
        "resourceUri": "[concat(resourceId('Microsoft.Sql/servers', parameters('sqlServerName')), '/elasticPools/ElasticPool1')]",
        "metricName": "[concat(parameters('alertrules_dtu_name'),'_consumption_percent')]"
      },
      "threshold": 90,
      "windowSize": "PT10M"
    },
    "action": {
      "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
      "customEmails": [
        "xxx@xxx.com"
      ]
    }
  }
}

这是我在部署时收到的错误消息:

New-AzureRmResourceGroupDeployment : 4:36:15 PM - Resource microsoft.insights/alertrules 'DTUAlert' failed with message '{ "code": "UnsupportedMetric", "message": "The metric with namespace '' and name 'DTUAlert_consumption_percent' is not supported for this resource

知道我做错了什么吗?我试过手动创建模板,针对不同版本的 API,等等......仍然得到同样的错误。

指标名称看起来不对。您可以尝试使用以下指标名称 = dtu_consumption_percent?