Skip to content

Latest commit

 

History

History
114 lines (72 loc) · 4.12 KB

advisor-alerts-bicep.md

File metadata and controls

114 lines (72 loc) · 4.12 KB
title description ms.topic ms.custom ms.date
Create Azure Advisor alerts for new recommendations using Bicep
Learn how to set up an alert for new recommendations from Azure Advisor using Bicep.
quickstart
subject-armqs, mode-arm, devx-track-bicep
04/26/2022

Quickstart: Create Azure Advisor alerts on new recommendations using Bicep

This article shows you how to set up an alert for new recommendations from Azure Advisor using Bicep.

[!INCLUDE About Bicep]

Whenever Azure Advisor detects a new recommendation for one of your resources, an event is stored in Azure Activity log. You can set up alerts for these events from Azure Advisor using a recommendation-specific alerts creation experience. You can select a subscription and optionally select a resource group to specify the resources that you want to receive alerts on.

You can also determine the types of recommendations by using these properties:

  • Category
  • Impact level
  • Recommendation type

You can also configure the action that will take place when an alert is triggered by:

  • Selecting an existing action group
  • Creating a new action group

To learn more about action groups, see Create and manage action groups.

Note

Advisor alerts are currently only available for High Availability, Performance, and Cost recommendations. Security recommendations are not supported.

Prerequisites

Review the Bicep file

The Bicep file used in this quickstart is from Azure Quickstart Templates.

:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.insights/insights-alertrules-servicehealth/main.bicep":::

The Bicep file defines two resources:

Deploy the Bicep file

  1. Save the Bicep file as main.bicep to your local computer.

  2. Deploy the Bicep file using either Azure CLI or Azure PowerShell.

    az group create --name exampleRG --location eastus
    az deployment group create --resource-group exampleRG --template-file main.bicep --parameters alertName=<alert-name>
    
    New-AzResourceGroup -Name exampleRG -Location eastus
    New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -alertName "<alert-name>"
    

    [!NOTE] Replace <alert-name> with the name of the alert.

    When the deployment finishes, you should see a message indicating the deployment succeeded.

Validate the deployment

Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.

az resource list --resource-group exampleRG
Get-AzResource -ResourceGroupName exampleRG

Clean up resources

When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group.

az group delete --name exampleRG
Remove-AzResourceGroup -Name exampleRG

Next steps