CmdID / az / az monitor / az monitor activity-log / az monitor activity-log alert
az monitor activity-log alert create
Create a default activity log alert rule. Azure CLI reference
This command will create a default activity log with one condition which compares if the activities logs 'category' field equals to 'ServiceHealth'. The newly created activity log alert does not have any action groups attached to it.
4 examples 7 options Its page in the Azure CLI reference
Examples
Create an alert rule with default settings.
az monitor activity-log alert create -n AlertName -g ResourceGroupIdentify-nThe name of the activity log alert.-gName of resource group.Create an alert rule with condition about error level service health log.
az monitor activity-log alert create -n AlertName -g ResourceGroup --condition category=ServiceHealth and level=ErrorIdentify-nThe name of the activity log alert.-gName of resource group.Create an alert rule with an action group and specify webhook properties.
az monitor activity-log alert create -n AlertName -g ResourceGroup -a /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/microsoft.insights/actionGroups/{ActionGroup} -w usage=test owner=janeIdentify-nThe name of the activity log alert.-gName of resource group.Create an alert rule which is initially disabled.
az monitor activity-log alert create -n AlertName -g ResourceGroup --disableIdentify-nThe name of the activity log alert.-gName of resource group.Options
--action-groupsThe list of the Action Groups.--activity-log-alert-name, --name, -nThe name of the activity log alert.--all-ofThe list of Activity Log Alert rule conditions.--descriptionA description of this Activity Log Alert rule.--enabledIndicates whether this Activity Log Alert rule is enabled.--scopesA list of resource IDs that will be used as prefixes.--tagsThe tags of the resource.