Skip to content

Commit 2039239

Browse files
Merge pull request #262275 from AbbyMSFT/alert-cli
Add links to CLI article
2 parents 12c291e + 8e20125 commit 2039239

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article shows you how to create a new alert rule using the CLI
44
author: AbbyMSFT
55
ms.author: abbyweisberg
66
ms.topic: how-to
7-
ms.date: 11/29/2023
7+
ms.date: 01/03/2024
88
ms.reviewer: harelbr
99
---
1010
# Create a new alert rule using the CLI, PowerShell, or an ARM template
@@ -14,14 +14,17 @@ You can create a new alert rule using the [the CLI](#create-a-new-alert-rule-usi
1414

1515
You can create a new alert rule using the [Azure CLI](/cli/azure/get-started-with-azure-cli). The following code examples use [Azure Cloud Shell](../../cloud-shell/overview.md). You can see the full list of the [Azure CLI commands for Azure Monitor](/cli/azure/azure-cli-reference-for-monitor#azure-monitor-references).
1616

17-
1. In the [portal](https://portal.azure.com/), select **Cloud Shell**. At the prompt, use the commands that follow.
17+
1. In the [portal](https://portal.azure.com/), select **Cloud Shell**. At the prompt, use these.
1818

19-
To create a metric alert rule, use the `az monitor metrics alert create` command. You can see detailed documentation on the metric alert rule create command in the `az monitor metrics alert create` section of the [CLI reference documentation for metric alerts](/cli/azure/monitor/metrics/alert).
19+
- To create a metric alert rule, use the [az monitor metrics alert create](/cli/azure/monitor/metrics/alert) command.
20+
- To create a log alert rule, use the [az monitor scheduled-query create](/cli/azure/monitor/scheduled-query) command.
21+
- To create an activity log alert rule, use the [az monitor activity-log alert create](/cli/azure/monitor/activity-log/alert) command.
2022

21-
To create a metric alert rule that monitors if average Percentage CPU on a VM is greater than 90:
23+
For example, to create a metric alert rule that monitors if average Percentage CPU on a VM is greater than 90:
2224
```azurecli
2325
az monitor metrics alert create -n {nameofthealert} -g {ResourceGroup} --scopes {VirtualMachineResourceID} --condition "avg Percentage CPU > 90" --description {descriptionofthealert}
2426
```
27+
2528
## Create a new alert rule using PowerShell
2629
2730
- To create a metric alert rule using PowerShell, use the [Add-AzMetricAlertRuleV2](/powershell/module/az.monitor/add-azmetricalertrulev2) cmdlet.
@@ -43,6 +46,7 @@ You can use an [Azure Resource Manager template (ARM template)](../../azure-reso
4346
- For metric alerts: [Resource Manager template samples for metric alert rules](resource-manager-alerts-metric.md)
4447
- For log alerts: [Resource Manager template samples for log alert rules](resource-manager-alerts-log.md)
4548
- For activity log alerts: [Resource Manager template samples for activity log alert rules](resource-manager-alerts-activity-log.md)
49+
- For service health alerts: [Resource Manager template samples for service health alert rules](resource-manager-alerts-service-health.md)
4650
- For resource health alerts: [Resource Manager template samples for resource health alert rules](resource-manager-alerts-resource-health.md)
4751
1. Edit the template file to contain appropriate information for your alert, and save the file as \<your-alert-template-file\>.json.
4852
1. Edit the corresponding parameters file to customize the alert, and save as \<your-alert-template-file\>.parameters.json.

0 commit comments

Comments
 (0)