Skip to content

Commit af23f27

Browse files
authored
Merge pull request #191558 from ofirmanor/patch-5
Update alerts-action-rules.md
2 parents c72e091 + 36c3110 commit af23f27

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ In the fourth tab (**Details**), you give this rule a name, pick where it will b
124124

125125
### [Azure CLI](#tab/azure-cli)
126126

127-
You can use the Azure CLI to work with alert processing rules. See the `az monitor alert-processing-rules` page in the [Azure CLI docs](/cli/azure/monitor/alert-processing-rule) for detailed documentation and examples.
127+
You can use the Azure CLI to work with alert processing rules. See the `az monitor alert-processing-rules` [page in the Azure CLI docs](/cli/azure/monitor/alert-processing-rule) for detailed documentation and examples.
128128

129129
### Prepare your environment
130130

@@ -169,30 +169,37 @@ For example, to create a rule that adds an action group to all alerts in a subsc
169169

170170
```azurecli
171171
az monitor alert-processing-rule create \
172-
--name 'AddActionGroupToSubscription' \
173-
--rule-type AddActionGroups \
174-
--scopes "/subscriptions/sub1" \
175-
--action-groups "/subscriptions/sub1/resourcegroups/rg1/providers/microsoft.insights/actiongroups/ag1" \
176-
--enabled true \
177-
--resource-group rg1 \
178-
--description "Add action group ag1 to all alerts in the subscription"
172+
--name 'AddActionGroupToSubscription' \
173+
--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"
179178
```
180179

181180
The [CLI documentation](/cli/azure/monitor/alert-processing-rule#az-monitor-alert-processing-rule-create) include more examples and an explanation of each parameter.
182181

183182
### [PowerShell](#tab/powershell)
184183

184+
You can use PowerShell to work with alert processing rules. See the `*-AzAlertProcessingRule` commands [in the PowerShell docs](/powershell/module/az.alertsmanagement) for detailed documentation and examples.
185+
186+
185187
### Create an alert processing rule using PowerShell
186188

187189
Use the `Set-AzAlertProcessingRule` command to create alert processing rules.
188190
For example, to create a rule that adds an action group to all alerts in a subscription, run:
189191

190192
```powershell
191-
Set-AzAlertProcessingRule -ResourceGroupName rg1 -Name AddActionGroupToSubscription -Scope /subscriptions/MySubId -Description "Add action group ag1 to all alerts in the subscription" -AlertProcessingRuleType AddActionGroups -ActionGroupId /subscriptions/sub1/resourcegroups/rg1/providers/microsoft.insights/actiongroups/ag1
192-
193+
Set-AzAlertProcessingRule `
194+
-Name AddActionGroupToSubscription `
195+
-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"
193200
```
194201

195-
The [CLI documentation](/cli/azure/monitor/alert-processing-rule#az-monitor-alert-processing-rule-create) include more examples and an explanation of each parameter.
202+
The [PowerShell documentation](/cli/azure/monitor/alert-processing-rule#az-monitor-alert-processing-rule-create) include more examples and an explanation of each parameter.
196203

197204
* * *
198205

0 commit comments

Comments
 (0)