Skip to content

Commit 41abbbf

Browse files
committed
clarification about metric alerts
1 parent 1b80d06 commit 41abbbf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

articles/azure-monitor/alerts/alerts-create-rule-cli-powershell-arm.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ You can create a new alert rule using the [Azure CLI](/cli/azure/get-started-wit
2929
## Create a new alert rule using PowerShell
3030
3131
- 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`.
3234
- To create a log alert rule using PowerShell, use the [New-AzScheduledQueryRule](/powershell/module/az.monitor/new-azscheduledqueryrule) cmdlet.
3335
- To create an activity log alert rule using PowerShell, use the [Set-AzActivityLogAlert](/powershell/module/az.monitor/set-azactivitylogalert) cmdlet.
3436
@@ -38,11 +40,13 @@ You can use an [Azure Resource Manager template (ARM template)](../../azure-reso
3840
3941
1. Create a new resource, using the following resource types:
4042
- For metric alerts: `Microsoft.Insights/metricAlerts`
41-
- For log alerts: `Microsoft.Insights/scheduledQueryRules`
42-
- For activity log, service health, and resource health alerts: `microsoft.Insights/activityLogAlerts`
4343
> [!NOTE]
4444
> - 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).
4545
> - We recommend that you create the metric alert using the same resource group as your target resource.
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.
47+
- For log alerts: `Microsoft.Insights/scheduledQueryRules`
48+
- For activity log, service health, and resource health alerts: `microsoft.Insights/activityLogAlerts`
49+
4650
1. Copy one of the templates from these sample ARM templates.
4751
- For metric alerts: [Resource Manager template samples for metric alert rules](resource-manager-alerts-metric.md)
4852
- For log alerts: [Resource Manager template samples for log alert rules](resource-manager-alerts-log.md)

0 commit comments

Comments
 (0)