Chart a metric and create an alert

Azure Portal, Hands On15 minutesFree tierSteps checked 25 October 2026By Cloud Hands On

In this task you'll create an alert on a resource's metric.

Metrics are numbers that Azure records about your resources every minute: a VM's CPU, a storage account's transactions, a database's connections. You can chart them, pin the chart to a dashboard and set alerts on them.

An alert rule watches a condition, such as more than 100 transactions in 5 minutes. When it fires, it calls an action group, which can email people, send a text or start an automation.

Example. SS Kaiser has an alert on its web server's CPU: above 85% for 15 minutes emails the on-call engineer and posts in the team's chat, long before customers notice the site slowing down.

Before you start

You need: Monitoring Contributor or Contributor. Time: 15 minutes.

Where to look

  1. Storage accounts
  2. your account
  3. Metrics

Steps

  1. You need a resource to watch. Create a storage account in rg-portal-practice if you no longer have one (section 8), and upload a file or two.
  2. Open the storage account and select Metrics (under Monitoring). Choose the metric Transactions and look at the chart.Change the time range at the top right to see the last hour or day.
  3. Select New alert rule. The condition is filled in from the chart: set it to greater than 100 over 5 minutes.
  4. On Actions, select Create action group. Name it ag-practice, add an email notification to your own address, and create it.
  5. On Details, name the rule alert-many-transactions, pick severity 3, then Review + create and Create.
  6. Check the action group's confirmation email, and see the rule under Alerts, Alert rules.

Tip. Metrics and Alerts are under Monitoring in every resource's left menu. Monitor shows the same for all resources.

Commands

# An action group that emails you
az monitor action-group create --resource-group rg-portal-practice --name ag-practice \
  --short-name agpractice --action email me <your email>

# A metric alert on the storage account's transactions
az monitor metrics alert create --resource-group rg-portal-practice \
  --name alert-many-transactions \
  --scopes $(az storage account show --name <account> --query id --output tsv) \
  --condition "total Transactions > 100" --window-size 5m --evaluation-frequency 5m \
  --action ag-practice

Watch out for

Cost
Metric alert rules have a small monthly charge for each metric they watch (around 10 US cents). Email notifications are free up to a generous monthly limit.
Security
Alert emails can reveal resource names and problems. Send them to team addresses you control, and review action groups when people leave.
Common mistakes
Setting thresholds so low that alerts fire all the time, so people start ignoring them. Forgetting to add an action group, so the alert fires and nobody hears about it.

Clean up

  1. Monitor
  2. Alerts
  3. Alert rules

Delete alert-many-transactions from the Alert rules list, and ag-practice from Action groups. Deleting the resource group also removes them if they were created in it.

Words to know

Metric
A number recorded about a resource at regular intervals, such as CPU percentage.
Alert rule
A condition to watch, how often to check it, and what to do when it's met.
Action group
A reusable list of who to notify and how, used by alert rules.

Tick off each step and track your progress in the guide.

Open this task in Azure Portal, Hands On

Keep going