Ensure that an Activity Log Alert exists for Service Health
Description
Create an activity log alert for Service Health.
Rationale
Monitoring for Service Health events provides insight into service issues, planned maintenance, security advisories, and other changes that may affect the Azure services and regions in use.
Impact
There is no charge for creating activity log alert rules.
Audit Procedure
Using Azure Portal
- Go to
Monitor. - Click
Alerts. - Click
Alert rules. - Ensure an alert rule exists for a subscription with
Conditionset toService names=All, Event types=AllandTarget resource typeset toSubscription. - If an alert rule is found for step 4, click the name of the alert rule.
- Ensure the
Actionspanel displays an action group configured to notify appropriate personnel. - Repeat steps 1-6 for each subscription.
Using Azure CLI
Run the following command to list activity log alerts:
az monitor activity-log alert list --subscription <subscription-id>
For each activity log alert, run the following command:
az monitor activity-log alert show --subscription <subscription-id> --resource-group <resource-group> --activity-log-alert-name <activity-log-alert>
Ensure an alert exists for ServiceHealth with scopes set to a subscription ID.
Repeat for each subscription.
Using PowerShell
Run the following command to locate ServiceHealth alert rules for a subscription:
Get-AzActivityLogAlert -SubscriptionId <subscription-id> | where-object {$_.ConditionAllOf.Equal -match "ServiceHealth"} | select-object Location,Name,Enabled,ResourceGroupName,ConditionAllOf
Ensure that at least one ServiceHealth alert rule is returned.
Repeat for each subscription.
Expected Result
An activity log alert rule should exist for Service Health with ServiceHealth category and an action group assigned to notify appropriate personnel.
Remediation
Remediate from Azure Portal
- Go to
Monitor. - Click
Alerts. - Click
+ Create. - Select
Alert rulefrom the drop-down menu. - Choose a subscription.
- Click
Apply. - Select the
Conditiontab. - Click
See all signals. - Select
Service health. - Click
Apply. - Open the drop-down menu next to
Event types. - Check the box next to
Select all. - Select the
Actionstab. - Click
Select action groupsto select an existing action group, orCreate action groupto create a new action group. - Follow the prompts to choose or create an action group.
- Select the
Detailstab. - Select a
Resource group, provide anAlert rule nameand an optionalAlert rule description. - Click
Review + create. - Click
Create. - Repeat steps 1-19 for each subscription requiring remediation.
Remediate from Azure CLI
For each subscription requiring remediation, run the following command to create a ServiceHealth alert rule for a subscription:
az monitor activity-log alert create --subscription <subscription-id> --resource-group <resource-group> --name <alert-rule> --condition category=ServiceHealth and properties.incidentType=Incident --scope /subscriptions/<subscription-id> --action-group <action-group>
Remediate from PowerShell
Create the Conditions object:
$conditions = @()
$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Field category -Equal ServiceHealth
$conditions += New-AzActivityLogAlertAlertRuleAnyOfOrLeafConditionObject -Field properties.incidentType -Equal Incident
Retrieve the Action Group information and store in a variable:
$actionGroup = Get-AzActionGroup -ResourceGroupName <resource-group> -Name <action-group>
$actionObject = New-AzActivityLogAlertActionGroupObject -Id $actionGroup.Id
Create the Scope object:
$scope = "/subscriptions/<subscription-id>"
Create the activity log alert rule:
New-AzActivityLogAlert -Name <alert-rule> -ResourceGroupName <resource-group> -Condition $conditions -Scope $scope -Location global -Action $actionObject -Subscription <subscription-id> -Enabled $true
Repeat for each subscription requiring remediation.
Default Value
By default, no monitoring alerts are created.
References
- https://learn.microsoft.com/en-us/azure/service-health/overview
- https://learn.microsoft.com/en-us/azure/service-health/alerts-activity-log-service-notifications-portal
- https://azure.microsoft.com/en-us/pricing/details/monitor/#faq
- https://learn.microsoft.com/en-us/cli/azure/monitor/activity-log/alert
- https://learn.microsoft.com/en-us/powershell/module/az.monitor/get-azactivitylogalert
- https://learn.microsoft.com/en-us/powershell/module/az.monitor/new-azactivitylogalert
CIS Controls
| Controls Version | Control | IG 1 | IG 2 | IG 3 |
|---|---|---|---|---|
| v8 | 8.5 Collect Detailed Audit Logs | x | x | |
| v7 | 6.3 Enable Detailed Logging | x | x |
MITRE ATT&CK Mappings
| Techniques / Sub-techniques | Tactics | Mitigations |
|---|---|---|
| M1047 |
Profile
Level 1 | Automated