Create Alert Rules and an Action Group

Lab overview

Monitoring data is only useful if someone sees it when it matters. With vm-surfcity-01 now reporting to log-surfcity, this lab closes the loop: you build an action group called ag-surfcity-it that emails Surf City IT using the common alert schema, then create a metric alert rule named alert-vm-surfcity-01-cpu that fires at Severity 2 when the server's average CPU stays above 80% for five minutes, and attach the two together. You finish by confirming the rule is enabled, Metrics-based, and wired to the action group.

Why you'd do this

Azure Monitor separates what to watch from who to tell, and that split is the whole design. An alert rule owns the signal, the threshold, and the evaluation window. An action group owns the notification targets and any automation. Keeping them apart means one action group can serve dozens of rules, and when the on-call rotation changes you edit a single email list instead of every rule in the subscription. You'll build the action group first for exactly that reason.

Two action-group choices deserve attention. The Region is Global, which the portal preselects because action groups are a global service that isn't tied to a datacenter. And you'll turn on the common alert schema, which gives every alert type the same JSON shape; it's the setting that lets a ticketing system, a Logic App, or a webhook consume alerts without a parser per alert kind. The email target is Lester's address because he's the on-screen Surf City administrator.

The alert rule's condition reads like a sentence, and the wizard's Preview card writes it for you: whenever the average Percentage CPU is greater than 80%. Static threshold means a fixed number rather than a machine-learned baseline, Average smooths out spikes, and the pair of five-minute values under When to evaluate are the two knobs that control noise: the lookback period is how much data each evaluation considers and check every is how often it runs. Since the signal is the host metric Percentage CPU, this rule would have worked even before lab 8; the agent you installed there is what makes guest-metric rules possible next.

On the Details tab, Severity 2 (Warning) is the right level for a hot server that's still serving requests; Sev 0 and 1 are for outages. The two advanced options you'll confirm, Enable upon creation and Automatically resolve alerts, are what keep the rule from being a flood: when CPU drops back under 80% the alert closes itself, so Surf City IT gets a clear fire-and-recover pair of emails rather than an open ticket nobody remembers to close. Alert rules, action groups, severities, and the common alert schema are all AZ-104 objectives under monitoring Azure resources.

Lab details

  • Action group: ag-surfcity-it in rg-surfcity-infra · Region Global · Display name SurfCityIT
  • Notification: Email → [email protected] · Common alert schema Yes · Name Email Surf City IT · no actions · tag environment = Lab
  • Alert rule: alert-vm-surfcity-01-cpu · Scope vm-surfcity-01 · Signal Percentage CPU
  • Condition: Static · Average · Greater than · 80 % · Check every 5 minutes · Lookback 5 minutes
  • Details: Severity 2 - Warning · description "vm-surfcity-01 CPU above 80% for 5 minutes" · Enable upon creation and Automatically resolve alerts both checked · tag Environment = Lab
  • Verification: Alert rules tab shows Enabled, Sev 2, Metrics; rule's Actions box shows ag-surfcity-it

Learning objectives

  1. Create an action group with an email notification and explain why it is a global resource.
  2. Enable the common alert schema and explain what it standardizes.
  3. Create a static metric alert rule on a VM with a threshold, aggregation, evaluation frequency, and lookback period.
  4. Attach an action group to an alert rule and choose an appropriate severity.
  5. Explain the effect of Enable upon creation and Automatically resolve alerts.
  6. Verify an alert rule's state, signal type, and actions after creation.

Exam relevance

  • AZ-104 — Microsoft Azure Administrator — monitor resources with Azure Monitor: create and configure metric alert rules, action groups, alert severity, common alert schema.
  • AZ-900 — Microsoft Azure Fundamentals — Azure Monitor alerts and action groups as part of operating cloud resources.

Where this lab fits in the project

Lab 8 gave Surf City IT visibility into vm-surfcity-01; this lab makes that visibility actionable. The action group and alert rule land in rg-surfcity-infra alongside everything else, and the action group becomes a recurring character: lab 12 uses it to prove that the resource group's Delete lock really blocks a deletion.

With monitoring and alerting in place, the project turns to protecting the server itself: lab 10 backs it up and lab 11 proves the backup can bring it back.

Step-by-step instructions

  1. Open Azure Monitor alerts:
    • In the search box at the top of the portal, type Monitor and select it under Services; in the left menu, select Alerts and review the summary page.
    • Select the Alert rules tab and confirm no alert rules exist for the subscription yet, then select the Monitor | Alerts breadcrumb.
    • Select Action groups at the top.
  2. Create the action group:
    • Select + Create, confirm the Surf City Boats subscription, and select resource group rg-surfcity-infra.
    • Confirm the Region shows Global.
    • In the Action group name field, type ag-surfcity-it; in the Display name field, type SurfCityIT, then select Next: Notifications.
  3. Add the email notification:
    • In the Notification type dropdown, select Email/SMS message/Push/Voice.
    • In the pane, check Email, type [email protected], set Enable the common alert schema to Yes, and select OK.
    • In the Name field for the notification row, type Email Surf City IT, then select Next: Actions.
    • Confirm no actions are configured (Surf City IT only needs email for now), then select Next: Tags.
    • In the Name field, select Environment; in the Value field, select Lab; then select Review + create and confirm the summary shows the group name, display name, and one email notification.
  4. Create the action group:
    • Select Create and wait for the notification that the action group was created.
    • Select Refresh and confirm ag-surfcity-it appears in the list with resource group rg-surfcity-infra.
  5. Open the alert rule wizard from the VM:
    • Search for vm-surfcity-01 and select it under Resources; in the left menu, under Monitoring, select Alerts.
    • Select + Create → Alert rule.
    • On the Scope tab, confirm the scope shows vm-surfcity-01, then select Next: Condition.
  6. Configure the CPU condition:
    • In the Signal name dropdown, select Percentage CPU; review the Preview card showing recent CPU against the dashed 80% line and the rule's estimated cost.
    • Under Alert logic, note the condition was pre-filled from popular settings; confirm Threshold type Static, Aggregation type Average, Value is Greater than, and Threshold 80.
    • Under When to evaluate, set Check every to 5 minutes and confirm the Lookback period is 5 minutes.
    • Confirm the Preview card reads "Whenever the average Percentage CPU is greater than 80%", then select Next: Actions.
  7. Attach the action group:
    • Select Select action groups, check ag-surfcity-it, and select Select.
    • Confirm ag-surfcity-it is listed with one email notification, then select Next: Details.
  8. Configure the alert details:
    • In the Severity dropdown, select 2 - Warning.
    • Name the rule alert-vm-surfcity-01-cpu and enter the description vm-surfcity-01 CPU above 80% for 5 minutes; confirm the resource group is rg-surfcity-infra.
    • Expand Advanced options, scroll down, and confirm Enable upon creation and Automatically resolve alerts are both checked, then select Next: Tags.
    • In the Name field, select Environment; in the Value field, select Lab; then select Review + create.
    • Confirm the summary shows scope vm-surfcity-01, condition Percentage CPU greater than 80, action group ag-surfcity-it, and Severity 2, then select Create.
  9. Verify the alert rule:
    • On the vm-surfcity-01 Alerts page, select Alert rules at the top and confirm alert-vm-surfcity-01-cpu is listed with Status Enabled, Severity Sev 2, and Signal type Metrics.
    • Select alert-vm-surfcity-01-cpu and, in the Actions box, confirm ag-surfcity-it is attached.
    • Return to the portal Home page.

Launch the lab simulation — included with the labITpro All-Access Pass; no Azure subscription required.

An Introduction to Microsoft Entra ID

Learn what you need to know to get started with Microsoft Entra ID with this easily-digestible 5-hour bootcamp from best-selling instructor, Thomas Mitchell.

Disable these ads by becoming a labITpro Supporter!

Azure vNets Explained

Want to learn about Azure virtual networks? In this quick-hitting explanation, you’ll learn what they are, what they do, and you’ll learn about key Azure vNet features.

Disable these ads by becoming a labITpro Supporter!