You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/alerts/alerts-create-new-alert-rule.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,6 +282,7 @@ You can create a new alert rule using the [Azure CLI](/cli/azure/get-started-wit
282
282
### [Log alert](#tab/log)
283
283
284
284
To create a log alert rule that monitors count of system event errors:
285
+
285
286
```azurecli
286
287
az monitor scheduled-query create -g {ResourceGroup} -n {nameofthealert} --scopes {vm_id} --condition "count \'union Event, Syslog | where TimeGenerated > a(1h) | where EventLevelName == \"Error\" or SeverityLevel== \"err\"\' > 2" --description {descriptionofthealert}
287
288
```
@@ -299,11 +300,10 @@ You can create a new alert rule using the [Azure CLI](/cli/azure/get-started-wit
299
300
- [az monitor activity-log alert action-group](/cli/azure/monitor/activity-log/alert/action-group): Add an action group to the activity log alert rule.
300
301
301
302
---
302
-
303
303
## Create a new alert rule using PowerShell
304
304
305
305
- To create a metric alert rule using PowerShell, use this cmdlet: [Add-AzMetricAlertRuleV2](/powershell/module/az.monitor/add-azmetricalertrulev2)
306
-
- To create a log alert rule using PowerShell, use this cmdlet: [New-AzScheduledQueryRule](/powershell/module/az.monitor/new-azscheduledqueryrule?)
306
+
- To create a log alert rule using PowerShell, use this cmdlet: [New-AzScheduledQueryRule](/powershell/module/az.monitor/new-azscheduledqueryrule)
307
307
- To create an activity log alert rule using PowerShell, use this cmdlet: [Set-AzActivityLogAlert](/powershell/module/az.monitor/set-azactivitylogalert)
308
308
309
309
## Create an activity log alert rule from the Activity log pane
|Learn more about the command|`az monitor metrics alert --help`|
66
66
67
67
## Manage metric alert rules with PowerShell
68
68
@@ -90,41 +90,17 @@ This section describes how to manage log alerts using the cross-platform [Azure
90
90
91
91
92
92
1. In the [portal](https://portal.azure.com/), select **Cloud Shell**.
93
+
1. Use these options of the `az monitor metrics alert` CLI command in this table:
93
94
94
-
You can use commands with ``--help`` option to learn more about the command and how to use it. For example, the following command shows you the list of commands available for creating, viewing, and managing log alerts.
95
-
96
-
```azurecli
97
-
az monitor scheduled-query --help
98
-
```
99
-
100
-
### View all the log alert rules in a resource group
101
-
102
-
```azurecli
103
-
az monitor scheduled-query list -g {ResourceGroup}
104
-
```
105
-
106
-
### See the details of a log alert rule
107
-
108
-
Use the name or the resource ID of the rule in the following command:
109
-
110
-
```azurecli
111
-
az monitor scheduled-query show -g {ResourceGroup} -n {AlertRuleName}
112
-
```
113
-
```azurecli
114
-
az monitor scheduled-query show --ids {RuleResourceId}
115
-
```
116
-
117
-
### Disable a log alert rule
118
-
119
-
```azurecli
120
-
az monitor scheduled-query update -g {ResourceGroup} -n {AlertRuleName} --disabled true
121
-
```
122
-
123
-
### Delete a log alert rule
124
-
125
-
```azurecli
126
-
az monitor scheduled-query delete -g {ResourceGroup} -n {AlertRuleName}
127
-
```
95
+
96
+
|What you want to do|CLI command |
97
+
|---------|---------|
98
+
|View all the log alert rules in a resource group|`az monitor scheduled-query list -g {ResourceGroup}`|
99
+
|See the details of a log alert rule|`az monitor scheduled-query show -g {ResourceGroup} -n {AlertRuleName}`|
100
+
||`az monitor scheduled-query show --ids {RuleResourceId}`|
|Learn more about the command|`az monitor scheduled-query --help`|
128
104
129
105
### Manage log alert rules using the Azure Resource Manager CLI with [templates](./alerts-log-create-templates.md)
130
106
@@ -139,6 +115,10 @@ az deployment group create \
139
115
140
116
A 201 response is returned on successful creation. 200 is returned on successful updates.
141
117
118
+
## Manage log alert rules with PowerShell
119
+
120
+
Log alert rules have this dedicated PowerShell cmdlet:
121
+
-[New-AzScheduledQueryRule](/powershell/module/az.monitor/new-azscheduledqueryrule): Creates a new log alert rule or updates an exising log alert rule.
142
122
## Manage activity log alert rules using PowerShell
143
123
144
124
Activity log alerts have these dedicated PowerShell cmdlets:
0 commit comments