az monitor action-rule
Commands to manage action rule.
Commands
az monitor action-rule create |
Create an action rule. |
az monitor action-rule delete |
Delete an action rule. |
az monitor action-rule list |
List all action rules of the subscription, created in given resource group and given input filters. |
az monitor action-rule show |
Get an action rule. |
az monitor action-rule update |
Update an action rule. |
az monitor action-rule create
Create an action rule.
az monitor action-rule create --name
--resource-group
--rule-type {ActionGroup, Diagnostics, Suppression}
[--alert-context]
[--alert-description]
[--alert-rule]
[--description]
[--location]
[--monitor-condition]
[--monitor-service]
[--scope]
[--scope-type {Resource, ResourceGroup}]
[--severity]
[--status {Disabled, Enabled}]
[--suppression-end-date]
[--suppression-end-time]
[--suppression-recurrence]
[--suppression-recurrence-type {Always, Daily, Monthly, Once, Weekly}]
[--suppression-start-date]
[--suppression-start-time]
[--tags]
[--target-resource-type]
Examples
Create an action rule to suppress notifications for all Sev4 alerts on all VMs within the subscription every weekend
az monitor action-rule create --resource-group rg --name rule --location Global --status Enabled --rule-type Suppression --severity Equals Sev4 --target-resource-type Equals Microsoft.Compute/VirtualMachines --suppression-recurrence-type Weekly --suppression-recurrence 0 6 --suppression-start-date 12/09/2018 --suppression-end-date 12/18/2018 --suppression-start-time 06:00:00 --suppression-end-time 14:00:00
Create an action rule to suppress notifications for all log alerts generated for Computer-01 in subscription indefinitely as it's going through maintenance
az monitor action-rule create --resource-group rg --name rule --location Global --status Enabled --rule-type Suppression --suppression-recurrence-type Always --alert-context Contains Computer-01 --monitor-service Equals "Log Analytics"
Create an action rule to suppress notifications in a resource group
az monitor action-rule create --resource-group rg --name rule --location Global --status Enabled --rule-type Suppression --scope-type ResourceGroup --scope /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/rg --suppression-recurrence-type Always --alert-context Contains Computer-01 --monitor-service Equals "Log Analytics"
Required Parameters
Name of action rule.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Indicate type of action rule.
Optional Parameters
Filter alerts by alert context (payload).
Filter alerts by alert rule description.
Filter alerts by alert rule name or ID.
Description of action rule.
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Filter alerts by monitor condition.
Filter alerts by monitor service.
List of ARM IDs (space-delimited) of the given scope type which will be the target of the given action rule.
Type of target scope.
Filter alerts by severity. All filters should follow format "operator value1 value2 ... valueN". Operator is one of Equals, NotEquals, Contains and DoesNotContain.
Indicate if the given action rule is enabled or disabled. Default to enabled.
End date for suppression. Format: MM/DD/YYYY.
End time for suppression. Format: hh:mm:ss.
List of recurrence pattern values, delimited by space. If --suppression-recurrence-type is Weekly, allowed values range from 0 to 6. 0 stands for Sunday, 1 stands for Monday, ..., 6 stands for Saturday. If --suppression-recurrence-type is Monthly, allowed values range from 1 to 31, stands for day of month.
Specifies when the suppression should be applied.
Start date for suppression. Format: MM/DD/YYYY.
Start time for suppression. Format: hh:mm:ss.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Filter alerts by target resource type.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az monitor action-rule delete
Delete an action rule.
az monitor action-rule delete --name
--resource-group
Examples
Delete an action rule
az monitor action-rule delete --resource-group rg --name rule
Required Parameters
Name of action rule.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az monitor action-rule list
List all action rules of the subscription, created in given resource group and given input filters.
az monitor action-rule list [--action-group]
[--alert-rule-id]
[--description]
[--impacted-scope]
[--monitor-service]
[--name]
[--resource-group]
[--severity]
[--target-resource]
[--target-resource-group]
[--target-resource-type]
Examples
List action rules of the subscription
az monitor action-rule list
List action rules of the resource group
az monitor action-rule list --resource-group rg
Optional Parameters
Filter by action group configured as part of action rule.
Filter by alert rule ID.
Filter by alert rule description.
Filter by impacted/target scope (provide comma separated list for multiple scopes). The value should be an well constructed ARM id of the scope.
Filter by monitor service which generates the alert instance. Default value is select all.
Filter by action rule name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Filter by severity. Default value is select all.
Filter by target resource (which is full ARM ID). Default value is select all.
Filter by target resource group name. Default value is select all.
Filter by target resource type. Default value is select all.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az monitor action-rule show
Get an action rule.
az monitor action-rule show --name
--resource-group
Examples
Get an action rule
az monitor action-rule show --resource-group rg --name rule
Required Parameters
Name of action rule.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az monitor action-rule update
Update an action rule.
az monitor action-rule update --name
--resource-group
[--add]
[--force-string]
[--location]
[--remove]
[--set]
[--status {Disabled, Enabled}]
[--tags]
Examples
Update an action rule
az monitor action-rule update --resource-group rg --name rule --status Disabled
Required Parameters
Name of action rule.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
Update an object by specifying a property path and value to set. Example: --set property1.property2=.
Indicates if the given action rule is enabled or disabled.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.