Share via


Metric Alerts - Create Or Update

Create or update an metric alert definition.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}?api-version=2024-03-01-preview

URI Parameters

Name In Required Type Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

ruleName
path True

string

The name of the rule.

subscriptionId
path True

string

minLength: 1

The ID of the target subscription.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
location True

string

Resource location

properties.criteria True MetricAlertCriteria:

Defines the specific alert criteria information.

properties.enabled True

boolean

The flag that indicates whether the metric alert is enabled.

properties.evaluationFrequency True

string (duration)

How often the metric alert is evaluated represented in ISO 8601 duration format.

properties.scopes True

string[]

The list of resource id's that this metric alert is scoped to. You cannot change the scope of a metric rule based on logs.

properties.severity True

integer (int32)

Alert severity {0, 1, 2, 3, 4}

identity

Identity

The identity of the resource.

properties.actionProperties

object

The properties of an action properties.

properties.actions

MetricAlertAction[]

The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.

properties.autoMitigate

boolean

The flag that indicates whether the alert should be auto resolved or not. The default is true.

properties.customProperties

object

The properties of an alert payload.

properties.description

string

The description of the metric alert that will be included in the alert email.

properties.resolveConfiguration

ResolveConfiguration

The configuration for how the alert is resolved. Applicable for PromQLCriteria.

properties.targetResourceRegion

string

The region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource.

properties.targetResourceType

string

The resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource.

properties.windowSize

string (duration)

The period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.

tags

object

Resource tags

Responses

Name Type Description
200 OK

MetricAlertResource

OK

Other Status Codes

ErrorResponse

BadRequest

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Create or update a dynamic alert rule for Multiple Resources
Create or update a dynamic alert rule for Single Resource
Create or update a query based alert rule
Create or update a query based alert rule with dynamic threshold
Create or update a resource centric query based alert rule
Create or update a resource centric query based alert rule for Multiple Resources
Create or update a web test alert rule
Create or update an alert rule for Multiple Resource
Create or update an alert rule for Single Resource
Create or update an alert rule on Resource group(s)
Create or update an alert rule on Subscription
Create or update an alert rules with dimensions

Create or update a dynamic alert rule for Multiple Resources

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertOnMultipleResources?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          }
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          }
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update a dynamic alert rule for Single Resource

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          },
          "ignoreDataBefore": "2019-04-04T21:00:00.000Z"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          },
          "ignoreDataBefore": "2019-04-04T21:00:00.000Z"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update a query based alert rule

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview

{
  "location": "eastus",
  "tags": {},
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT5M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "StaticThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"}) > 90"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "eastus",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "identity": {
    "type": "UserAssigned",
    "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {
        "clientId": "778f4d04-3c60-4622-a839-5cf05866c983",
        "principalId": "669dd76d-cde8-4dc3-b882-1de566b0c628"
      }
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT2M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "StaticThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"}) > 90"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Create or update a query based alert rule with dynamic threshold

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview

{
  "location": "eastus",
  "tags": {},
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT5M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "DynamicThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"})",
          "operator": "LessThan",
          "alertSensitivity": "Medium",
          "ignoreDataBefore": "2019-04-04T21:00:00.000Z"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "eastus",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "identity": {
    "type": "UserAssigned",
    "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {
        "clientId": "778f4d04-3c60-4622-a839-5cf05866c983",
        "principalId": "669dd76d-cde8-4dc3-b882-1de566b0c628"
      }
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT2M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "DynamicThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"})",
          "operator": "LessThan",
          "alertSensitivity": "Medium",
          "ignoreDataBefore": "2019-04-04T21:00:00.000Z"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Create or update a resource centric query based alert rule

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview

{
  "location": "eastus",
  "tags": {},
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.compute/virtualMachines/myVmName"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT5M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "StaticThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"}) > 90"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "eastus",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "identity": {
    "type": "UserAssigned",
    "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {
        "clientId": "778f4d04-3c60-4622-a839-5cf05866c983",
        "principalId": "669dd76d-cde8-4dc3-b882-1de566b0c628"
      }
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.compute/virtualMachines/myVmName"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT2M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "StaticThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"}) > 90"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Create or update a resource centric query based alert rule for Multiple Resources

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview

{
  "location": "eastus",
  "tags": {},
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {}
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT5M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "StaticThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"}) by (\"microsoft.resourceid\") > 90"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "eastus",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "identity": {
    "type": "UserAssigned",
    "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
    "userAssignedIdentities": {
      "/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {
        "clientId": "778f4d04-3c60-4622-a839-5cf05866c983",
        "principalId": "669dd76d-cde8-4dc3-b882-1de566b0c628"
      }
    }
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"
    ],
    "evaluationFrequency": "PT1M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
      "failingPeriods": {
        "for": "PT2M"
      },
      "allOf": [
        {
          "name": "Metric1",
          "criterionType": "StaticThresholdCriterion",
          "query": "avg({\"system.cpu.utilization\"}) by (\"microsoft.resourceid\") > 90"
        }
      ]
    },
    "resolveConfiguration": {
      "autoResolved": true,
      "timeToResolve": "PT10M"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"
      }
    ],
    "actionProperties": {
      "Email.Sujbect": "my custom email subject"
    },
    "customProperties": {
      "key11": "value11",
      "key12": "value12"
    }
  }
}

Create or update a web test alert rule

Sample request

PUT https://management.azure.com/subscriptions/12345678-1234-1234-1234-123456789101/resourceGroups/rg-example/providers/Microsoft.Insights/metricAlerts/webtest-name-example?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": "Resource",
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": "Resource"
  },
  "properties": {
    "description": "Automatically created alert rule for availability test \"component-example\" a",
    "enabled": true,
    "severity": 4,
    "windowSize": "PT15M",
    "evaluationFrequency": "PT1M",
    "criteria": {
      "failedLocationCount": 2,
      "webTestId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
      "componentId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example",
      "odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"
    },
    "actions": [],
    "scopes": [
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"
    ]
  }
}

Sample response

{
  "location": "global",
  "type": "Microsoft.Insights/metricAlerts",
  "name": "webtest-name-example",
  "id": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example",
  "tags": {
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": "Resource",
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": "Resource"
  },
  "properties": {
    "description": "Automatically created alert rule for availability test \"webtest-name-example\" a",
    "severity": 4,
    "enabled": true,
    "scopes": [
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example",
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "criteria": {
      "webTestId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example",
      "componentId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example",
      "failedLocationCount": 2,
      "odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"
    },
    "actions": []
  }
}

Create or update an alert rule for Multiple Resource

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertOnMultipleResources?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rule for Single Resource

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "\\Processor(_Total)\\% Processor Time",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "\\Processor(_Total)\\% Processor Time",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rule on Resource group(s)

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/Microsoft.Insights/metricAlerts/MetricAlertAtResourceGroupLevel?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rule on Subscription

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertAtSubscriptionLevel?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rules with dimensions

Sample request

PUT https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertOnMultipleDimensions?api-version=2024-03-01-preview

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "enabled": true,
    "severity": 3,
    "windowSize": "P1D",
    "evaluationFrequency": "PT1H",
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource"
    ],
    "criteria": {
      "allOf": [
        {
          "metricName": "Availability",
          "metricNamespace": "Microsoft.KeyVault/vaults",
          "operator": "GreaterThan",
          "timeAggregation": "Average",
          "name": "Metric1",
          "dimensions": [
            {
              "name": "ActivityName",
              "operator": "Include",
              "values": [
                "*"
              ]
            },
            {
              "name": "StatusCode",
              "operator": "Include",
              "values": [
                "200"
              ]
            }
          ],
          "criterionType": "StaticThresholdCriterion",
          "threshold": 55
        }
      ],
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ],
    "autoMitigate": true
  }
}

Sample response

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertWithDimensions",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
  },
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource"
    ],
    "evaluationFrequency": "PT1H",
    "windowSize": "P1D",
    "targetResourceType": "Microsoft.KeyVault/vaults",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "metricName": "Availability",
          "metricNamespace": "Microsoft.KeyVault/vaults",
          "operator": "GreaterThan",
          "timeAggregation": "Average",
          "name": "Metric1",
          "dimensions": [
            {
              "name": "ActivityName",
              "operator": "Include",
              "values": [
                "*"
              ]
            },
            {
              "name": "StatusCode",
              "operator": "Include",
              "values": [
                "200"
              ]
            }
          ],
          "criterionType": "StaticThresholdCriterion",
          "threshold": 55
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Definitions

Name Description
AdditionalInfo

An array of objects with 'type' and 'info' properties. The schema of 'info' is service-specific and dependent on the 'type' string.

AggregationTypeEnum

The criteria time aggregation types. Previously undocumented values might be returned

DynamicMetricCriteria

Criterion for dynamic threshold.

DynamicPromQLCriteria

The criterion for dynamic prom query.

DynamicThresholdFailingPeriods

The minimum number of violations required within the selected lookback time window required to raise an alert.

DynamicThresholdOperator

The operator used to compare the metric value against the threshold. Previously undocumented values might be returned

DynamicThresholdSensitivity

The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Previously undocumented values might be returned

Error
ErrorDetail

Describes details of an error response.

ErrorResponse

Describes the format of Error response.

Identity

Identity for the resource.

IdentityType

Type of managed service identity. Previously undocumented values might be returned

MetricAlertAction

An alert action.

MetricAlertMultipleResourceMultipleMetricCriteria

Specifies the metric alert criteria for multiple resource that has multiple metric criteria.

MetricAlertResource

The metric alert resource.

MetricAlertSingleResourceMultipleMetricCriteria

Specifies the metric alert criteria for a single resource that has multiple metric criteria.

MetricCriteria

Criterion to filter metrics.

MetricDimension

Specifies a metric dimension.

Operator

The criteria operator. Previously undocumented values might be returned

PromQLCriteria

Specifies the PromQL criteria for the metric alert resource.

QueryFailingPeriods

Configuration for failing periods in query-based alerts.

ResolveConfiguration
StaticPromQLCriteria

The criterion for static prom query.

UserIdentityProperties

Properties of the user assigned identity.

WebtestLocationAvailabilityCriteria

Specifies the metric alert rule criteria for a web test resource.

AdditionalInfo

An array of objects with 'type' and 'info' properties. The schema of 'info' is service-specific and dependent on the 'type' string.

Name Type Description
info

The additional information specific to the type.

type

string

The type of additional information.

AggregationTypeEnum

The criteria time aggregation types. Previously undocumented values might be returned

Value Description
Average
Count
Minimum
Maximum
Total

DynamicMetricCriteria

Criterion for dynamic threshold.

Name Type Description
alertSensitivity

DynamicThresholdSensitivity

The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Previously undocumented values might be returned

criterionType string:

DynamicThresholdCriterion

Specifies the type of threshold criteria. Previously undocumented values might be returned

dimensions

MetricDimension[]

List of dimension conditions.

failingPeriods

DynamicThresholdFailingPeriods

The minimum number of violations required within the selected lookback time window required to raise an alert.

ignoreDataBefore

string (date-time)

Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format)

metricName

string

Name of the metric.

metricNamespace

string

Namespace of the metric.

name

string

Name of the criteria.

operator

DynamicThresholdOperator

The operator used to compare the metric value against the threshold. Previously undocumented values might be returned

skipMetricValidation

boolean

Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped.

timeAggregation

AggregationTypeEnum

The criteria time aggregation types. Previously undocumented values might be returned

DynamicPromQLCriteria

The criterion for dynamic prom query.

Name Type Description
alertSensitivity

DynamicThresholdSensitivity

The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Previously undocumented values might be returned

criterionType string:

DynamicThresholdCriterion

Specifies the type of threshold criteria. Previously undocumented values might be returned

ignoreDataBefore

string (date-time)

Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format)

name

string

Name of the criteria.

operator

DynamicThresholdOperator

The operator used to compare the metric value against the threshold. Previously undocumented values might be returned

query

string

The query used to evaluate the alert rule

DynamicThresholdFailingPeriods

The minimum number of violations required within the selected lookback time window required to raise an alert.

Name Type Description
minFailingPeriodsToAlert

number

The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods.

numberOfEvaluationPeriods

number

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.

DynamicThresholdOperator

The operator used to compare the metric value against the threshold. Previously undocumented values might be returned

Value Description
GreaterThan
LessThan
GreaterOrLessThan

DynamicThresholdSensitivity

The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Previously undocumented values might be returned

Value Description
Low
Medium
High

Error

Name Type Description
additionalInfo

AdditionalInfo[]

An array of objects with 'type' and 'info' properties. The schema of 'info' is service-specific and dependent on the 'type' string.

code

string

Unlocalized string which can be used to programmatically identify the error.

details

ErrorDetail[]

An array of additional nested error response info objects, as described by this contract.

message

string

Describes the error in detail and provides debugging information. If Accept-Language is set in the request, it must be localized to that language.

target

string

The target of the particular error (for example, the name of the property in error).

ErrorDetail

Describes details of an error response.

Name Type Description
additionalInfo

AdditionalInfo[]

An array of objects with 'type' and 'info' properties. The schema of 'info' is service-specific and dependent on the 'type' string.

code

string

Unlocalized string which can be used to programmatically identify the error.

message

string

Describes the error in detail and provides debugging information.

target

string

The target of the particular error (for example, the name of the property in error).

ErrorResponse

Describes the format of Error response.

Name Type Description
error

Error

Identity

Identity for the resource.

Name Type Description
principalId

string

The principal ID of resource identity.

tenantId

string

The tenant ID of resource.

type

IdentityType

Type of managed service identity. Previously undocumented values might be returned

userAssignedIdentities

<string,  UserIdentityProperties>

The list of user identities associated with the resource. The user identity dictionary key references will be Azure resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.

IdentityType

Type of managed service identity. Previously undocumented values might be returned

Value Description
SystemAssigned
UserAssigned
None

MetricAlertAction

An alert action.

Name Type Description
actionGroupId

string

The id of the action group to use.

webHookProperties

object

This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook.

MetricAlertMultipleResourceMultipleMetricCriteria

Specifies the metric alert criteria for multiple resource that has multiple metric criteria.

Name Type Description
allOf MultiMetricCriteria[]:

The list of multiple metric criteria for this 'all of' operation.

odata.type string:

Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria

Specifies the type of the alert criteria. Previously undocumented values might be returned

MetricAlertResource

The metric alert resource.

Name Type Description
id

string

Azure resource Id

identity

Identity

The identity of the resource.

location

string

Resource location

name

string

Azure resource name

properties.actionProperties

object

The properties of an action properties.

properties.actions

MetricAlertAction[]

The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.

properties.autoMitigate

boolean

The flag that indicates whether the alert should be auto resolved or not. The default is true.

properties.criteria MetricAlertCriteria:

Defines the specific alert criteria information.

properties.customProperties

object

The properties of an alert payload.

properties.description

string

The description of the metric alert that will be included in the alert email.

properties.enabled

boolean

The flag that indicates whether the metric alert is enabled.

properties.evaluationFrequency

string (duration)

How often the metric alert is evaluated represented in ISO 8601 duration format.

properties.isMigrated

boolean

The value indicating whether this alert rule is migrated.

properties.lastUpdatedTime

string (date-time)

Last time the rule was updated in ISO8601 format.

properties.resolveConfiguration

ResolveConfiguration

The configuration for how the alert is resolved. Applicable for PromQLCriteria.

properties.scopes

string[]

The list of resource id's that this metric alert is scoped to. You cannot change the scope of a metric rule based on logs.

properties.severity

integer (int32)

Alert severity {0, 1, 2, 3, 4}

properties.targetResourceRegion

string

The region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource.

properties.targetResourceType

string

The resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource.

properties.windowSize

string (duration)

The period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.

tags

object

Resource tags

type

string

Azure resource type

MetricAlertSingleResourceMultipleMetricCriteria

Specifies the metric alert criteria for a single resource that has multiple metric criteria.

Name Type Description
allOf

MetricCriteria[]

The list of metric criteria for this 'all of' operation.

odata.type string:

Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria

Specifies the type of the alert criteria. Previously undocumented values might be returned

MetricCriteria

Criterion to filter metrics.

Name Type Description
criterionType string:

StaticThresholdCriterion

Specifies the type of threshold criteria. Previously undocumented values might be returned

dimensions

MetricDimension[]

List of dimension conditions.

metricName

string

Name of the metric.

metricNamespace

string

Namespace of the metric.

name

string

Name of the criteria.

operator

Operator

The criteria operator. Previously undocumented values might be returned

skipMetricValidation

boolean

Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped.

threshold

number (double)

The criteria threshold value that activates the alert.

timeAggregation

AggregationTypeEnum

The criteria time aggregation types. Previously undocumented values might be returned

MetricDimension

Specifies a metric dimension.

Name Type Description
name

string

Name of the dimension.

operator

string

The dimension operator. Only 'Include' and 'Exclude' are supported

values

string[]

List of dimension values.

Operator

The criteria operator. Previously undocumented values might be returned

Value Description
Equals
GreaterThan
GreaterThanOrEqual
LessThan
LessThanOrEqual

PromQLCriteria

Specifies the PromQL criteria for the metric alert resource.

Name Type Description
allOf MultiPromQLCriteria[]:

The list of promQL criteria. Alert will be raised when all conditions are met.

failingPeriods

QueryFailingPeriods

Configuration for failing periods in query-based alerts.

odata.type string:

Microsoft.Azure.Monitor.PromQLCriteria

Specifies the type of the alert criteria. Previously undocumented values might be returned

QueryFailingPeriods

Configuration for failing periods in query-based alerts.

Name Type Description
for

string (duration)

The amount of time (in ISO 8601 duration format) alert must be active before firing.

ResolveConfiguration

Name Type Description
autoResolved

boolean

Indicates whether the alert should be auto resolved

timeToResolve

string (duration)

The time (in ISO 8601 duration format) after which the alert should be auto resolved

StaticPromQLCriteria

The criterion for static prom query.

Name Type Description
criterionType string:

StaticThresholdCriterion

Specifies the type of threshold criteria. Previously undocumented values might be returned

name

string

Name of the criteria.

query

string

The query used to evaluate the alert rule

UserIdentityProperties

Properties of the user assigned identity.

Name Type Description
clientId

string

The client ID of resource identity.

principalId

string

The principal ID of resource identity.

WebtestLocationAvailabilityCriteria

Specifies the metric alert rule criteria for a web test resource.

Name Type Description
componentId

string

The Application Insights resource Id.

failedLocationCount

number

The number of failed locations.

odata.type string:

Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria

Specifies the type of the alert criteria. Previously undocumented values might be returned

webTestId

string

The Application Insights web test Id.