Create an Azure Monitor metric alert rule on database db1 using the metric:
CPU percentage
Configure the condition as:
Aggregation: Average
Operator: Greater than
Threshold: 50
Aggregation granularity / Period: 1 minute
Frequency of evaluation: 1 minute
Evaluation period / Lookback window: 5 minutes
Action group email: admin@contoso.com
Azure SQL Database exposes CPU percentage as a platform metric, and Azure Monitor metric alerts can send notifications through action groups such as email. Microsoft describes SQL Database alerts as metric-based alerts that can send email when metrics such as CPU usage reach a defined threshold.
Azure Portal Method — Recommended for Simulation
Step 1: Open the db1 Azure SQL database
Sign in to the Azure portal.
Search for SQL databases.
Open the database named:
db1
Do not open the SQL logical server unless the alert needs to apply to all databases. This task is specifically for db1, so the alert scope must be the db1 database resource.
Step 2: Create a new alert rule
From the db1 database page:
In the left menu, select Alerts.
Select Create.
Select Alert rule.
Microsoft’s Azure Monitor workflow allows you to create an alert rule directly from the target resource. When you create it from a resource, the resource is automatically set as the alert scope.
Step 3: Confirm the alert scope
On the alert rule page, confirm the scope is the Azure SQL database:
db1
The resource type should be similar to:
SQL database
Microsoft.Sql/servers/databases
If the scope is the SQL server instead of the database, remove it and select the db1 database resource.
Step 4: Add the alert condition
Under Condition, select Add condition.
Choose the metric:
CPU percentage
Sometimes it appears as:
CPU percent
or metric name:
cpu_percent
For Azure SQL Database, CPU percentage represents CPU consumption toward the database workload limit, expressed as a percentage.
Step 5: Configure the signal logic
Configure the alert logic exactly like this:
Setting
Value
Threshold type
Static
Aggregation type
Average
Operator
Greater than
Threshold value
50
Unit
Percent
Aggregation granularity / Period
1 minute
Frequency of evaluation
1 minute
Evaluation period / Lookback window
5 minutes
This means Azure Monitor evaluates the CPU metric every minute, using one-minute metric samples, and fires the alert only when the average CPU percentage is greater than 50% across the five-minute evaluation window.
Be precise here. The task says:
average CPU percentage utilization is greater than 50 percent for five minutes sampled at one-minute intervals
So the correct choices are:
Average
Greater than 50
Every 1 minute
Over the last 5 minutes
Azure Monitor metric alert rules combine the monitored resource, the metric condition, and action groups that run when the condition is met.
Step 6: Create the email action group
Under Actions, select:
Create action group
Configure the basics:
Setting
Value
Subscription
Use the current subscription
Resource group
Use the lab resource group
Action group name
AG-db1-CPU-Email
Display name
db1CPU
Then go to Notifications.
Add a notification:
Setting
Value
Notification type
Email/SMS message/Push/Voice
Name
EmailAdmin
Email
admin@contoso.com
Select OK, then Review + create, then Create.
Action groups define the notification or automation action that runs when an alert fires. Microsoft documents email as a supported action group notification type.
Step 7: Configure alert rule details
Under Details, configure:
Setting
Value
Severity
2 or 3
Alert rule name
db1 CPU greater than 50 percent
Description
Alert when average CPU percentage for db1 is greater than 50 percent for 5 minutes.
Enable upon creation
Yes
Severity is usually not specified by the task, so any reasonable severity is acceptable. In an exam lab, I would use Severity 2 for CPU performance impact.
Step 8: Review and create
Select Review + create.
Confirm the condition says something equivalent to:
Whenever the average CPU percentage is greater than 50
Confirm the evaluation settings are:
Check every 1 minute
Lookback period 5 minutes
Confirm the action group sends email to:
admin@contoso.com
Select Create.
Verification
After creation:
Open db1.
Go to Alerts.
Select Alert rules.
Confirm the alert rule exists and is enabled.
Open the rule and verify:
Scope: db1
Signal: CPU percentage
Aggregation: Average
Operator: Greater than
Threshold: 50
Evaluation frequency: 1 minute
Window size: 5 minutes
Action group: admin@contoso.com
Azure CLI Method
Use this only if the simulation gives you Cloud Shell.
First get the database resource ID:
az sql db show \
--resource-group < resource-group-name > \
--server < sql-server-name > \
--name db1 \
--query id \
--output tsv
Create the action group:
az monitor action-group create \
--resource-group < resource-group-name > \
--name AG-db1-CPU-Email \
--short-name db1CPU \
--action email EmailAdmin admin@contoso.com
Create the metric alert:
az monitor metrics alert create \
--name " db1 CPU greater than 50 percent " \
--resource-group < resource-group-name > \
--scopes < db1-resource-id > \
--condition " avg cpu_percent > 50 " \
--window-size 5m \
--evaluation-frequency 1m \
--action AG-db1-CPU-Email \
--description " Alert when average CPU percentage for db1 is greater than 50 percent for 5 minutes. "
The metric name commonly used for Azure SQL Database CPU percentage in CLI/ARM contexts is:
cpu_percent
SSMS Clarification
SSMS is not the correct tool for this task.
Do not configure Database Mail. Azure SQL Database does not use SQL Server Agent/Database Mail in the same way as SQL Server on a VM or SQL Managed Instance. This requirement is an Azure Monitor metric alert requirement.
Correct tool:
Azure portal > db1 > Alerts > Create alert rule
Wrong tool:
SSMS Database Mail
Final Exam-Lab Configuration
Use this exact configuration:
Resource: db1
Alert type: Metric alert
Metric: CPU percentage
Aggregation: Average
Operator: Greater than
Threshold: 50
Aggregation granularity: 1 minute
Evaluation frequency: 1 minute
Evaluation period/window: 5 minutes
Action group notification: Email
Email recipient: admin@contoso.com
That completes the task.