-1

I am trying to create an ARM template to add alert metrics to my elastic pool database. I've done this manually in the portal and am using the ARM template generated from the portal.

Here is the ARM template:

    {
  "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"
      ]
    }
  }
}

Here is the error message I get when deploying this:

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

Any idea what I'm doing wrong here? I've tried creating the template manually, targeting different versions of the API, etc... still get the same error.

CtrlDot
  • 2,463
  • 14
  • 11

1 Answers1

0

The metric name looks wrong. Can you try with the following metric name = dtu_consumption_percent?

Andy Shen
  • 962
  • 6
  • 7