0Pricing
Cloud & IT Cert Prep · Lesson

Azure Monitor Metrics and Alerts

Collect platform metrics for VMs and App Service, configure static and dynamic threshold alerts, and route alert notifications to action groups via email and webhook.

Azure Monitor Metrics and Alerts is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Is Azure Monitor?

Azure Monitor is the unified observability platform for all Azure resources. It collects metrics (numerical time-series data) and logs (structured records of events) from every service you deploy. Without Azure Monitor you would be operating blind — unable to detect performance degradation or capacity issues before they affect users.

Understanding Platform Metrics

Platform metrics are automatically collected for every Azure resource at no extra cost. For a virtual machine, Azure Monitor captures Percentage CPU, Network In, Network Out, Disk Read Bytes, and many more. These metrics are stored at one-minute granularity for 93 days in the metrics store. No agent or configuration is required to start seeing them.

# View available metrics for a VM via Azure CLI
az monitor metrics list-definitions \
  --resource /subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.Compute/virtualMachines/<vm-name> \
  --output table

Viewing Metrics in Metrics Explorer

The Metrics Explorer in the Azure portal lets you chart any platform metric interactively. Select a resource, choose a metric namespace, pick a metric, and choose an aggregation type (Average, Maximum, Minimum, Count, or Sum). You can overlay multiple metrics, split by dimension (e.g. by disk or network interface), and pin the chart to an Azure Dashboard.

Static Threshold Alerts

A metric alert rule triggers when a metric crosses a fixed threshold for a defined evaluation period. For example: fire an alert when Percentage CPU is greater than 85% for 5 consecutive minutes. Alert rules consist of a target resource, a condition, and an action group that defines what happens when the alert fires.

# Create a static CPU alert via CLI
az monitor metrics alert create \
  --name 'High-CPU-Alert' \
  --resource-group myRG \
  --scopes /subscriptions/<sub>/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM \
  --condition 'avg Percentage CPU > 85' \
  --window-size 5m \
  --evaluation-frequency 1m \
  --action myActionGroup

Dynamic Threshold Alerts

Dynamic thresholds use machine learning to automatically set alert boundaries based on historical behaviour. Instead of hardcoding a CPU percentage, Azure Monitor learns the normal pattern of your metric and alerts only when the value deviates significantly. This reduces false positives for metrics whose natural level varies by time of day or day of week. Set sensitivity to Low, Medium, or High.

Action Groups

An action group defines the notifications and automated actions that run when an alert fires. Supported notification types include Email/SMS/Push, Voice, and Azure app notifications. Automated actions include calling an Azure Function, posting to a Logic App, triggering a webhook, or running an Automation Runbook. One action group can be shared across many alert rules.

# Create an action group with email notification
az monitor action-group create \
  --name 'OpsTeam' \
  --resource-group myRG \
  --action email 'ops-lead' 'ops@example.com'

Alert Severity Levels

Every alert rule is assigned a severity from Sev 0 (Critical) to Sev 4 (Verbose). Severity does not affect when the alert fires — it is metadata used by operations teams to triage incidents. Best practice is to page on-call engineers only for Sev 0 and Sev 1 alerts, route Sev 2 to a ticket queue, and treat Sev 3–4 as informational.

Activity Log Alerts

Activity log alerts fire on administrative operations recorded in the Azure Activity Log rather than on metrics. Use them to get notified when someone deletes a resource group, changes a network security group rule, or restarts a VM. They are configured identically to metric alerts but target an activity log condition such as operation name or resource type.

# Alert when any VM in a resource group is deleted
az monitor activity-log alert create \
  --name 'VM-Delete-Alert' \
  --resource-group myRG \
  --condition category=Administrative operationName=Microsoft.Compute/virtualMachines/delete \
  --action-group myActionGroup

Alert States and Alert Processing Rules

An alert instance moves through three states: FiredAcknowledgedResolved. Alert processing rules (formerly suppression rules) let you suppress notifications during scheduled maintenance windows or add action groups to all alerts that match a scope — without modifying each alert rule individually. This is essential for managing alert noise during deployments.

Metric Alerts for PaaS Services

Platform metrics are not limited to VMs. App Service exposes Http5xx, RequestCount, and AverageResponseTime. Azure SQL Database exposes cpu_percent and dtu_consumption_percent. Azure Storage exposes UsedCapacity and Transactions. You apply the same metric alert model across all these services, giving you a uniform monitoring approach regardless of resource type.

# Alert on App Service HTTP 5xx errors
az monitor metrics alert create \
  --name 'AppService-5xx-Alert' \
  --resource-group myRG \
  --scopes /subscriptions/<sub>/resourceGroups/myRG/providers/Microsoft.Web/sites/myApp \
  --condition 'total Http5xx > 10' \
  --window-size 5m \
  --evaluation-frequency 1m \
  --action myActionGroup

Multi-Resource Alerts

Azure Monitor supports multi-resource metric alerts that apply a single rule to all resources of the same type in a subscription or resource group. For example, one alert rule can monitor all VMs in a resource group for high CPU. This dramatically reduces the number of rules you need to manage compared to creating one rule per VM. Multi-resource alerts are scoped to a resource group or subscription and a specific resource type.

Quick Check

Test your understanding of Microsoft Azure Fundamentals (AZ-900) concepts from this lesson.

Lesson Recap

In this lesson you learned: Azure Monitor automatically collects platform metrics from every Azure resource, metric alert rules trigger on static or dynamic thresholds and notify teams via action groups, and activity log alerts fire on administrative operations like resource deletion. Next up we explore Log Analytics and KQL for querying structured log data.

Frequently asked questions

Is the “Azure Monitor Metrics and Alerts” lesson free?

Yes — the full text of “Azure Monitor Metrics and Alerts” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.

What will I learn in “Azure Monitor Metrics and Alerts”?

Collect platform metrics for VMs and App Service, configure static and dynamic threshold alerts, and route alert notifications to action groups via email and webhook. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cloud & IT Cert Prep?

No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Azure Monitor Metrics and Alerts” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cloud & IT Cert Prep lesson?

Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Azure Monitor Metrics and Alerts
  2. Log Analytics and KQL Fundamentals
  3. Application Insights
  4. Azure Dashboards and Workbooks
← Back to Cloud & IT Cert Prep