A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-create-rule-cli-powershell-arm below:

Create Azure Monitor alert rules using the CLI, PowerShell, or an ARM template - Azure Monitor

Create a new alert rule using the CLI, PowerShell, or an ARM template

In this article

You can create a new alert rule using the the CLI, PowerShell, or an Azure Resource Manager template.

Prerequisites

To create or edit an alert rule, you must have the following permissions:

Create a new alert rule using the CLI

You can create a new alert rule using the Azure CLI. The following code examples use Azure Cloud Shell. You can see the full list of the Azure CLI commands for Azure Monitor.

  1. In the portal, select Cloud Shell. At the prompt, use these.

    For example, to create a metric alert rule that monitors if average Percentage CPU on a virtual machine (VM) is greater than 90:

     az monitor metrics alert create -n {nameofthealert} -g {ResourceGroup} --scopes {VirtualMachineResourceID} --condition "avg Percentage CPU > 90" --description {descriptionofthealert}
    
Create a new alert rule using PowerShell Create a new alert rule using an ARM template

You can use an Azure Resource Manager template (ARM template) to configure alert rules consistently in all of your environments.

  1. Create a new resource, using the following resource types:

  2. Copy one of the templates from these sample ARM templates.

  3. Edit the template file to contain appropriate information for your alert, and save the file as <your-alert-template-file>.json.

  4. Edit the corresponding parameters file to customize the alert, and save as <your-alert-template-file>.parameters.json.

  5. Set the metricName parameter, using one of the values in Azure Monitor supported metrics.

  6. Deploy the template using PowerShell or the CLI.

Next steps

Additional resources

In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4