Skip to content

Commit 34042ba

Browse files
authored
Merge pull request #191560 from ofirmanor/patch-5
Update alerts-action-rules.md
2 parents 8fe2a07 + da328a5 commit 34042ba

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

articles/azure-monitor/alerts/alerts-action-rules.md

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,34 @@ An alert processing rule definition covers several aspects:
5454

5555
### Which fired alerts are affected by this rule?
5656

57-
Each alert processing rule has a **scope**. A scope is a list of one or more specific Azure resources, or specific resource group, or an entire subscription. The alert processing rule will apply to alerts that fired on resources within that scope.
57+
**SCOPE**
58+
Each alert processing rule has a scope. A scope is a list of one or more specific Azure resources, or specific resource group, or an entire subscription. **The alert processing rule will apply to alerts that fired on resources within that scope**.
5859

59-
You can also define **filters** to narrow down which specific subset of alerts are affected. The available filters are:
60+
**FILTERS**
61+
You can also define filters to narrow down which specific subset of alerts are affected within the scope. The available filters are:
6062

6163
* **Alert Context (payload)** - the rule will apply only to alerts that contain any of the filter's strings within the [alert context](./alerts-common-schema-definitions.md#alert-context) section of the alert. This section includes fields specific to each alert type.
62-
* **Alert rule id** - the rule will apply only to alerts from a specific alert rule. The value should be the full resource ID, for example "/subscriptions/SUB1/resourceGroups/RG1/providers/microsoft.insights/metricalerts/MY-API-LATENCY".
63-
You can locate the alert rule ID by opening a specific alert rule in the portal, clicking "Properties", and copying the "Resource ID" value. You can also locate it by listing your alert rules from CLI/PowerShell.
64+
* **Alert rule id** - the rule will apply only to alerts from a specific alert rule. The value should be the full resource ID, for example `/subscriptions/SUB1/resourceGroups/RG1/providers/microsoft.insights/metricalerts/MY-API-LATENCY`.
65+
You can locate the alert rule ID by opening a specific alert rule in the portal, clicking "Properties", and copying the "Resource ID" value.
66+
You can also locate it by listing your alert rules from PowerShell or CLI.
6467
* **Alert rule name** - the rule will apply only to alerts with this alert rule name. Can also be useful with a "Contains" operator.
6568
* **Description** - the rule will apply only to alerts that contain the specified string within the alert rule description field.
6669
* **Monitor condition** - the rule will apply only to alerts with the specified monitor condition, either "Fired" or "Resolved".
6770
* **Monitor service** - the rule will apply only to alerts from any of the specified monitor services.
6871
For example, use "Platform" to have the rule apply only to metric alerts.
6972
* **Resource** - the rule will apply only to alerts from the specified Azure resource.
70-
This filter is useful with "Does not equal" operator, or with "Contains" / "Does not contain" operators.
73+
For example, you can use this filter with "Does not equal" to exclude one or more resources when the rule's scope is a subscription.
7174
* **Resource group** - the rule will apply only to alerts from the specified resource groups.
72-
This filter is useful with "Does not equal" operator, or with "Contains" / "Does not contain" operators.
73-
* **Resource type** - the rule will apply only to alerts on resource from the specified resource types, such as virtual machines.
74-
* **Severity** - the rule will apply only to alerts with the selected severities.
75+
For example, you can use this filter with "Does not equal" to exclude one or more resource groups when the rule's scope is a subscription.
76+
* **Resource type** - the rule will apply only to alerts on resource from the specified resource types, such as virtual machines. You can use "Equals" to match one or more specific resources, or you can use contains to match a resource type and all its child resources.
77+
For example, use "contains MICROSOFT.SQL/SERVERS" to match both SQL servers and all their child resources, like databases.
78+
* **Severity** - the rule will apply only to alerts with the selected severities.
7579

76-
If you define multiple filters in a rule, all of them apply. For example, if you set **resource type = "Virtual Machines"** and **severity = "Sev0"**, then the rule will apply only for Sev0 alerts on virtual machines in the scope.
77-
78-
> [!NOTE]
79-
> Each filter may include up to five values.
80+
**FILTERS BEHAVIOR**
81+
* If you define multiple filters in a rule, all of them apply - there is a logical AND between all filters.
82+
For example, if you set both `resource type = "Virtual Machines` and `severity = "Sev0`, then the rule will apply only for Sev0 alerts on virtual machines in the scope.
83+
* Each filter may include up to five values, and there is a logical OR between the values.
84+
For example, if you set `description contains ["this", "that"]`, then the rule will apply only to alerts whose description contains either "this" or "that".
8085

8186
### What should this rule do?
8287

@@ -140,7 +145,7 @@ You can use the Azure CLI to work with alert processing rules. See the `az monit
140145

141146
1. **Sign in**
142147

143-
If you're using a local installation of the CLI, sign in using the [az login](/cli/azure/reference-index#az-login) command. Follow the steps displayed in your terminal to complete the authentication process.
148+
If you're using a local installation of the CLI, sign in using the `az login` [command](/cli/azure/reference-index#az-login). Follow the steps displayed in your terminal to complete the authentication process.
144149

145150
```azurecli
146151
az login
@@ -171,10 +176,10 @@ For example, to create a rule that adds an action group to all alerts in a subsc
171176
az monitor alert-processing-rule create \
172177
--name 'AddActionGroupToSubscription' \
173178
--rule-type AddActionGroups \
174-
--scopes "/subscriptions/sub1" \
175-
--action-groups "/subscriptions/sub1/resourcegroups/rg1/providers/microsoft.insights/actiongroups/ag1" \
176-
--resource-group rg1 \
177-
--description "Add action group ag1 to all alerts in the subscription"
179+
--scopes "/subscriptions/SUB1" \
180+
--action-groups "/subscriptions/SUB1/resourcegroups/RG1/providers/microsoft.insights/actiongroups/AG1" \
181+
--resource-group RG1 \
182+
--description "Add action group AG1 to all alerts in the subscription"
178183
```
179184

180185
The [CLI documentation](/cli/azure/monitor/alert-processing-rule#az-monitor-alert-processing-rule-create) include more examples and an explanation of each parameter.
@@ -193,10 +198,10 @@ For example, to create a rule that adds an action group to all alerts in a subsc
193198
Set-AzAlertProcessingRule `
194199
-Name AddActionGroupToSubscription `
195200
-AlertProcessingRuleType AddActionGroups `
196-
-Scope /subscriptions/MySubId `
197-
-ActionGroupId /subscriptions/sub1/resourcegroups/rg1/providers/microsoft.insights/actiongroups/ag1 `
198-
-ResourceGroupName rg1 `
199-
-Description "Add action group ag1 to all alerts in the subscription"
201+
-Scope /subscriptions/SUB1 `
202+
-ActionGroupId /subscriptions/SUB1/resourcegroups/RG1/providers/microsoft.insights/actiongroups/AG1 `
203+
-ResourceGroupName RG1 `
204+
-Description "Add action group AG1 to all alerts in the subscription"
200205
```
201206

202207
The [PowerShell documentation](/cli/azure/monitor/alert-processing-rule#az-monitor-alert-processing-rule-create) include more examples and an explanation of each parameter.
@@ -224,13 +229,13 @@ Before you manage alert processing rules with the Azure CLI, prepare your enviro
224229
az monitor alert-processing-rules list
225230
226231
# Get details of an alert processing rule
227-
az monitor alert-processing-rules show --resource-group MyResourceGroupName --name MyRule
232+
az monitor alert-processing-rules show --resource-group RG1 --name MyRule
228233
229234
# Update an alert processing rule
230-
az monitor alert-processing-rules update --resource-group MyResourceGroupName --name MyRule --status Disabled
235+
az monitor alert-processing-rules update --resource-group RG1 --name MyRule --status Disabled
231236
232237
# Delete an alert processing rule
233-
az monitor alert-processing-rules delete --resource-group MyResourceGroupName --name MyRule
238+
az monitor alert-processing-rules delete --resource-group RG1 --name MyRule
234239
```
235240

236241
### [PowerShell](#tab/powershell)
@@ -244,13 +249,13 @@ Before you manage alert processing rules with the Azure CLI, prepare your enviro
244249
Get-AzAlertProcessingRule
245250
246251
# Get details of an alert processing rule
247-
Get-AzAlertProcessingRule -ResourceGroupName MyResourceGroupName -Name MyRule | Format-List
252+
Get-AzAlertProcessingRule -ResourceGroupName RG1 -Name MyRule | Format-List
248253
249254
# Update an alert processing rule
250-
Update-AzAlertProcessingRule -ResourceGroupName MyResourceGroupName -Name MyRule -Enabled False
255+
Update-AzAlertProcessingRule -ResourceGroupName RG1 -Name MyRule -Enabled False
251256
252257
# Delete an alert processing rule
253-
Remove-AzAlertProcessingRule -ResourceGroupName MyResourceGroupName -Name MyRule
258+
Remove-AzAlertProcessingRule -ResourceGroupName RG1 -Name MyRule
254259
```
255260

256261
* * *

0 commit comments

Comments
 (0)