Information
Create an activity log alert for Service Health.
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.
Solution
Remediate from Azure Portal
- Go to Monitor
- Click Alerts
- Click + Create
- Select Alert rule from the drop-down menu.
- Choose a subscription.
- Click Apply
- Select the Condition tab.
- 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 Actions tab.
- Click Select action groups to select an existing action group, or Create action group to create a new action group.
- Follow the prompts to choose or create an action group.
- Select the Details tab.
- Select a Resource group provide an Alert rule name and an optional Alert 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>
Create the Actions object:
$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.
Impact:
There is no charge for creating activity log alert rules.