Microsoft.Insights metricAlerts template reference

Template format

To create a Microsoft.Insights/metricAlerts resource, add the following JSON to the resources section of your template.

{
  "name": "string",
  "type": "Microsoft.Insights/metricAlerts",
  "apiVersion": "2018-03-01",
  "location": "string",
  "tags": {},
  "properties": {
    "description": "string",
    "severity": "integer",
    "enabled": "boolean",
    "scopes": [
      "string"
    ],
    "evaluationFrequency": "string",
    "windowSize": "string",
    "targetResourceType": "string",
    "targetResourceRegion": "string",
    "criteria": {
      "odata.type": "string",
      "allOf": [
          { }
      ]
    },
    "autoMitigate": "boolean",
    "actions": [
      {
        "actionGroupId": "string",
        "webhookProperties": {}
      }
    ]
  }
}

The criteria.allOf property varies by object type.

For SingleResourceMultipleMetricCriteria object, use:

{
  "criterionType": "string",
  "dimensions": [],
  "metricName": "string",
  "metricNamespace": "string",
  "name": "string",
  "operator": "string",
  "threshold": "integer",
  "timeAggregation": "string"
}

For MultipleResourceMultipleMetricCriteria object, use:

{
  "criterionType": "string",
  "dimensions": [],
  "metricName": "string",
  "metricNamespace": "string",
  "name": "string",
  "operator": "string",
  "threshold": "integer",
  "timeAggregation": "string",
  "alertSensitivity": "string",
  "failingPeriods": {
    "minFailingPeriodsToAlert": "integer",
    "numberOfEvaluationPeriods": "integer"
  },
  "ignoreDataBefore": "string"
}

Property values

The following tables describe the values you need to set in the schema.

Microsoft.Insights/metricAlerts object

Name Type Required Value
name string Yes The name of the rule.
type enum Yes Microsoft.Insights/metricAlerts
apiVersion enum Yes 2018-03-01
location string Yes Resource location
tags object No Resource tags
properties object Yes The alert rule properties of the resource. - MetricAlertProperties object

MetricAlertProperties object

Name Type Required Value
description string Yes the description of the metric alert that will be included in the alert email.
severity integer Yes Alert severity {0, 1, 2, 3, 4}
enabled boolean Yes the flag that indicates whether the metric alert is enabled.
scopes array No the list of resource id's that this metric alert is scoped to. - string
evaluationFrequency string Yes how often the metric alert is evaluated represented in ISO 8601 duration format.
windowSize string Yes the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.
targetResourceType string No the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
targetResourceRegion string No the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
criteria object Yes defines the specific alert criteria information. - MetricAlertCriteria object
autoMitigate boolean No the flag that indicates whether the alert should be auto resolved or not.
actions array No the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - MetricAlertAction object

MetricAlertCriteria object

Name Type Required Value
odata.type string Yes specifies the type of the alert criteria. - Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria or Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
allOf array No Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria object or Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria

SingleResourceMultipleMetricCriteria object

Name Type Required Value
criterionType string Yes Specifies the type of threshold criteria - StaticThresholdCriterion
dimensions array No List of dimension conditions. - MetricDimension
metricName string Yes Name of the metric.
metricNamespace string No Namespace of the metric.
name string Yes Name of the criteria.
operator string Yes the criteria operator. - Equals, NotEquals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual
threshold integer Yes the criteria threshold value that activates the alert.
timeAggregation string Yes the criteria time aggregation types. - Average, Minimum, Maximum, Total

MultipleResourceMultipleMetricCriteria object

Name Type Required Value
criterionType string Yes Specifies the type of threshold criteria - DynamicThresholdCriterion
dimensions array No List of dimension conditions. - MetricDimension
metricName string Yes Name of the metric.
metricNamespace string No Namespace of the metric.
name string Yes Name of the criteria.
operator string Yes the criteria operator. - Equals, NotEquals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual
threshold integer Yes the criteria threshold value that activates the alert.
timeAggregation string Yes the criteria time aggregation types. - Average, Minimum, Maximum, Total
alertSensitivity string Yes The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. - Low, Medium, High
failingPeriods object Yes The minimum number of violations required within the selected lookback time window required to raise an alert. - failingPeriods
ignoreDataBefore string No Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format)

MetricDimension object

Name Type Required Value
name string Yes Name of the dimension.
operator string Yes the dimension operator. Only 'Include' and 'Exclude' are supported
values array Yes list of dimension values.

FailingPeriods object

Name Type Required Value
minFailingPeriodsToAlert integer Yes The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods.
numberOfEvaluationPeriods integer Yes The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points.

MetricAlertAction object

Name Type Required Value
actionGroupId string No the id of the action group to use.
webhookProperties object No The properties of a webhook object.