Tutorial: Create a metric alert for an Azure resource

Azure Monitor alerts proactively notify you when important conditions are found in your monitoring data. Metric alert rules create an alert when a metric value from an Azure resource exceeds a threshold.

In this tutorial, you learn how to:

  • Create a metric alert rule from metrics explorer
  • Configure the alert threshold
  • Create an action group to define notification details

Prerequisites

To complete this tutorial you need the following:

  • An Azure resource to monitor. You can use any resource in your Azure subscription that supports metrics. To determine whether a resource supports metrics, go to its menu in the Azure portal and verify that there's a Metrics option in the Monitoring section of the menu.
  • Chart in metrics explorer with one or more metrics that you want to alert on. Complete Tutorial: Analyze metrics for an Azure resource.

Create new alert rule

From metrics explorer, click New alert rule. The rule will be preconfigured with the target object and the metric that you selected in metrics explorer.

New alert rule

Configure alert logic

The resource will already be selected. You need to modify the signal logic to specify the threshold value and any other details for the alert rule.

Click on the Condition name to view these settings.

Alert rule configuration

The chart shows the value of the selected signal over time so that you can see when the alert would have been fired. This chart will update as you specify the signal logic.

Alert rule signal logic

The Alert logic is defined by the condition and the evaluation time. The alert fires when this condition is true. Provide a Threshold value for your alert rule and modify the Operator and Aggregation type to define the logic you need.

Alert rule alert logic

You can accept the default time granularity or modify it to your requirements. Frequency of evaluation defines how often the alert logic is evaluated. Aggregation granularity defines the time interval over which the collected values are aggregated.

Click Done when you're done configuring the signal logic.

Configure actions

Action groups define a set of actions to take when an alert is fired such as sending an email or an SMS message.

Click Add action groups to add one to the alert rule.

Add action group

If you don't already have an action group in your subscription to select, then click Create action group to create a new one.

Create action group

Select a Subscription and Resource group for the action group and give it an Action group name that will appear in the portal and a Display name that will appear in email and SMS notifications.

Action group basics

Select the Notifications tab and add one or more methods to notify appropriate people when the alert is fired.

Action group notifications

Configure details

Configure different settings for the alert rule in the Alert rule details section.

  • Alert rule name which should be descriptive since it will be displayed when the alert is fired.
  • Optionally provide a Description that's included in the details of the alert.
  • Subscription and Resource group where the alert rule will be stored. This doesn't need to be in the same resource group as the resource that you're monitoring.
  • Severity for the alert. The severity allows you to group alerts with a similar relative importance. A severity of Error is appropriate for an unresponsive virtual machine.
  • Keep the box checked to Enable alert upon creation.
  • Keep the box checked to Automatically resolve alerts. This will automatically resolve the alert when the metric value drops below the threshold.

Alert rule details

Click Create alert rule to create the alert rule.

View the alert

When an alert fires, it will send any notifications in its action groups. You can also view the alert in the Azure portal.

Select Alerts from the resource's menu. If there are any open alerts for the resources, they will be included in the view.

Alerts view

Click on a severity to show the alerts with that severity. Select the Alert state and unselect Closed to view only open alerts.

Alert state filter

Click on the name of an alert to view its detail.

Alert detail

Next steps

Now that you've learned how to create a metric alert for an Azure resource, use one of the following tutorials to collect log data.