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-rule-cli-powershell-arm.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ You can create a new alert rule using the [Azure CLI](/cli/azure/get-started-wit
29
29
## Create a new alert rule using PowerShell
30
30
31
31
- To create a metric alert rule using PowerShell, use the [Add-AzMetricAlertRuleV2](/powershell/module/az.monitor/add-azmetricalertrulev2) cmdlet.
32
+
> [!NOTE]
33
+
> When you create a metric alert on a single resource, the syntax uses the `TargetResourceId`. When you create a metric alert on multiple resources, the syntax contains the `TargetResourceScope`, `TargetResourceType`, and `TargetResourceRegion`.
32
34
- To create a log alert rule using PowerShell, use the [New-AzScheduledQueryRule](/powershell/module/az.monitor/new-azscheduledqueryrule) cmdlet.
33
35
- To create an activity log alert rule using PowerShell, use the [Set-AzActivityLogAlert](/powershell/module/az.monitor/set-azactivitylogalert) cmdlet.
34
36
@@ -38,11 +40,13 @@ You can use an [Azure Resource Manager template (ARM template)](../../azure-reso
38
40
39
41
1. Create a new resource, using the following resource types:
40
42
- For metric alerts: `Microsoft.Insights/metricAlerts`
43
+
> [!NOTE]
44
+
> - We recommend that you create the metric alert using the same resource group as your target resource.
45
+
> - Metric alerts for an Azure Log Analytics workspace resource type (`Microsoft.OperationalInsights/workspaces`) are configured differently than other metric alerts. For more information, see [Resource Template for Metric Alerts for Logs](alerts-metric-logs.md#resource-template-for-metric-alerts-for-logs).
46
+
> - If you are creating a metric alert for a single resource, the template uses the `ResourceId` of the target resource. If you are creating a metric alert for multiple resources, the template uses the `scope`, `TargetResourceType`, and `TargetResourceRegion` for the target resources.
41
47
- For log alerts: `Microsoft.Insights/scheduledQueryRules`
42
48
- For activity log, service health, and resource health alerts: `microsoft.Insights/activityLogAlerts`
43
-
> [!NOTE]
44
-
> - Metric alerts for an Azure Log Analytics workspace resource type (`Microsoft.OperationalInsights/workspaces`) are configured differently than other metric alerts. For more information, see [Resource Template for Metric Alerts for Logs](alerts-metric-logs.md#resource-template-for-metric-alerts-for-logs).
45
-
> - We recommend that you create the metric alert using the same resource group as your target resource.
49
+
46
50
1. Copy one of the templates from these sample ARM templates.
47
51
- For metric alerts: [Resource Manager template samples for metric alert rules](resource-manager-alerts-metric.md)
48
52
- For log alerts: [Resource Manager template samples for log alert rules](resource-manager-alerts-log.md)
Copy file name to clipboardExpand all lines: articles/azure-monitor/alerts/resource-manager-alerts-metric.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1970,7 +1970,8 @@ This section will describe Azure Resource Manager templates for three scenarios
1970
1970
1971
1971
> [!NOTE]
1972
1972
>
1973
-
> In a metric alert rule that monitors multiple resources, only one condition is allowed.
1973
+
> - In a metric alert rule that monitors multiple resources, only one condition is allowed.
1974
+
> - If you are creating a metric alert for a single resource, the template uses the `ResourceId` of the target resource. If you are creating a metric alert for multiple resources, the template uses the `scope`, `TargetResourceType`, and `TargetResourceRegion` for the target resources.
1974
1975
1975
1976
### Static threshold alert on all virtual machines in one or more resource groups
0 commit comments