Remediation
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, orCreate 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 anAlert rule name
and 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.