Remediation
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.
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>
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.