1. What is an Alert in Azure?
An Alert in Azure is a monitoring feature that automatically notifies you or triggers an action when a specific condition is met in your Azure resources.
Alerts are part of Azure Monitor.
Simple Example:
Suppose you have an Azure Virtual Machine running your application.
-
Normal CPU usage: 30–50%
-
CPU usage increases to 90%.
-
You configured an alert when CPU usage exceeds 80%.
-
Azure Monitor detects the condition.
-
Azure sends an email, SMS, or triggers an automated action.
You do not need to monitor your virtual machine manually.
2. How Azure Alerts Work
Azure Resource
(VM / App Service / SQL Database)
|
v
Azure Monitor
|
v
Alert Rule
|
v
Evaluate Condition
CPU Usage > 80%
|
+----+----+
| |
Yes No
| |
v v
Alert Fired No Alert
|
v
Action Group
|
+----> Email
|
+----> SMS
|
+----> Webhook
|
+----> Azure Function
Important Components
|
Component |
Description |
|---|---|
|
Alert Rule |
Defines what condition Azure should monitor. |
|
Signal |
The metric, log, or other data being monitored. |
|
Condition |
Example: CPU usage greater than 80%. |
|
Evaluation Frequency |
How frequently Azure checks the condition. |
|
Action Group |
Defines who gets notified or what action runs. |
|
Severity |
Defines alert importance from Sev 0 to Sev 4. |
3. Types of Alerts in Azure
Azure Monitor supports several alert types.
|
Alert Type |
Purpose |
Example |
|---|---|---|
|
Metric Alert |
Monitors numerical measurements. |
CPU usage exceeds 80%. |
|
Log Search Alert |
Evaluates log data using KQL. |
More than 10 application errors in 5 minutes. |
|
Activity Log Alert |
Monitors Azure control-plane events. |
A virtual machine is deleted. |
|
Smart Detection Alert |
Detects certain application anomalies automatically. |
Unusual failure-rate increase in Application Insights. |
4. What is a Stateful Alert?
A Stateful Alert remembers whether the alert condition is already active.
Once an alert fires, Azure does not repeatedly fire a new alert for every evaluation while the same condition remains active. The alert is resolved when Azure determines that the condition has recovered.
Example: CPU Usage
Alert condition: CPU usage greater than 80%.
|
Time |
CPU Usage |
Alert Status |
Notification |
|---|---|---|---|
|
10:00 AM |
45% |
Normal |
No |
|
10:05 AM |
85% |
Fired |
Yes |
|
10:10 AM |
90% |
Fired |
No new notification |
|
10:15 AM |
95% |
Fired |
No new notification |
|
10:20 AM |
40% |
Resolved after recovery criteria |
Resolution notification, if configured |
|
10:30 AM |
90% |
Fired again |
Yes |
Illustrative timeline. Actual firing and resolution depend on evaluation frequency, aggregation, and alert-type-specific recovery rules.
Stateful Alert Flow
CPU > 80%
|
v
Alert Fired
|
v
Notification Sent
|
v
CPU Still > 80%
|
v
No New Alert
|
v
CPU Returns to Normal
|
v
Alert Resolved
|
v
CPU > 80% Again
|
v
New Alert Fired
Key Points:
-
Remembers the active alert state.
-
Avoids repeated notifications for the same ongoing incident.
-
Supports automatic resolution.
-
Useful for CPU, memory, response time, and resource health monitoring.
5. What is a Stateless Alert?
A Stateless Alert does not maintain an ongoing fired/resolved state for the condition.
Whenever the alert condition is satisfied during an evaluation, Azure can fire a new alert, even if the same problem was detected previously.
Example: CPU Usage
Alert condition: CPU usage greater than 80%.
Evaluation frequency: Every 5 minutes.
|
Time |
CPU Usage |
Condition |
Notification |
|---|---|---|---|
|
10:00 AM |
45% |
False |
No |
|
10:05 AM |
85% |
True |
Yes |
|
10:10 AM |
90% |
True |
Yes |
|
10:15 AM |
95% |
True |
Yes |
|
10:20 AM |
40% |
False |
No |
|
10:25 AM |
90% |
True |
Yes |
Conceptual example. Actual notification frequency can be affected by alert processing and action-group behavior.
Stateless Alert Flow
Every 5 Minutes
|
v
Check CPU Usage
|
v
Is CPU > 80%?
|
+---+---+
| |
Yes No
| |
v v
Fire Wait
Alert |
| |
v |
Notify |
| |
+---+--+
|
v
Next Evaluation
Key Points:
-
Does not retain the active incident state.
-
Can generate multiple alerts for the same persistent condition.
-
Useful when each matching evaluation needs attention.
-
Can produce more notifications than stateful monitoring.
6. Stateful vs Stateless Alerts – Comparison
|
Feature |
Stateful |
Stateless |
|---|---|---|
|
Maintains alert state |
Yes |
No |
|
Repeated alert firing |
Suppressed while active |
Possible on each matching evaluation |
|
Automatic resolution |
Yes |
Not an ongoing resolved-state lifecycle |
|
Notification volume |
Generally lower |
Potentially higher |
|
Best for |
Persistent problems |
Repeated condition detection |
|
Example |
CPU consistently above 80% |
Error count repeatedly exceeds threshold |
|
Noise reduction |
Better |
Requires more care |
Important: Stateful and stateless behavior is not a universal setting across every Azure alert type. Metric alerts and log search alerts have different configuration options and resolution rules.
7. How to Configure Stateful or Stateless Alerts in Azure Portal
You can configure this behavior when creating a metric alert.
-
Open Azure Portal.
-
Search for Monitor.
-
Select Alerts → Create → Alert rule.
-
Select the resource, such as an Azure VM or App Service.
-
Under Condition, select a metric such as Percentage CPU.
-
Set the threshold to Greater than 80%.
-
Configure the evaluation frequency.
-
Under Actions, select or create an Action Group.
-
Open the Details tab and expand Advanced options.
Find the option:
Stateful Alert
Azure tracks the active condition and automatically resolves the alert after the recovery criteria are met.
Interactive explanation only — this does not change Azure settings.10. Select Review + create, then Create.
Microsoft confirms that metric alerts are stateful by default and that clearing this option makes them stateless.
8. Important Interview Questions
Q1. What is an Azure Alert?
An Azure Alert automatically detects specified conditions in Azure resources and can notify administrators or execute actions through Action Groups.
Q2. What is the difference between stateful and stateless alerts?
Stateful alerts remember the active condition and avoid firing repeatedly until recovery. Stateless alerts can fire repeatedly whenever the condition is met.
Q3. Are Azure Metric Alerts stateful by default?
Yes. Azure Monitor metric alerts are stateful by default.
Q4. When does a stateful metric alert resolve?
When the alert condition is not met for three consecutive evaluations.
Q5. Are Azure Activity Log Alerts stateful or stateless?
Activity Log Alerts are stateless because they represent individual events, such as a resource deletion or role assignment.
Q6. Can Log Search Alerts be stateful?
Yes. Log Search Alerts support both stateful and stateless behavior, with specific recovery rules.
Q7. Which alert type should be used for production monitoring?
For persistent problems such as high CPU utilization or application response time, stateful alerts are generally preferable because they reduce duplicate notifications.
Quick Revision:
-
Stateful: Alert once → Remain active → Recover → Resolve.
-
Stateless: Condition met → Fire → Condition met again → Fire again.
For additional reference, see Microsoft Learn – Azure Monitor Alerts.