question

MSTechie-7364 avatar image
0 Votes"
MSTechie-7364 asked MSTechie-7364 commented

IaC options for Azure Monitor Alerts

We have created lot of Azure Monitor alerts based on querying the Log analytics workspace using kusto query language.

I wanted to automate this using IaC options like Azure ARM .

Can you please suggest any good options (with links) to convert these Azure Alerts into Code, so that it can be deployed

azure-monitor
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered MSTechie-7364 commented

Hi @MSTechie-7364,

If its log alerts then refer this Azure document for instructions. If its metric alerts then refer this Azure document for instructions.

Also just FYI:

This is reference for overall ARM templates where you can drill down to resource type level to check the supported template format. For example, if you want to check the template format of resource type "Microsoft.Insights/scheduledQueryRules" then this is the ARM template reference for it.

As shown in highlighted part of the below screenshot, in the reference section of the Azure Monitor documentation you have the references of Azure Monitor related ARM templates, Azure PowerShell, Azure CLI, Azure REST API. Using one of these as well you can code the alerts creation or do any supported automation that is related to Azure Monitor.

127115-image.png


image.png (126.1 KiB)
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Amongst Azure ARM, Biceps or Terraform, which is the best option to choose for IaC for Azure Alerts ?

0 Votes 0 ·

Hi ,
we want to automate the creation of Azure Monitor Alerts on Log analytics queries using Azure PowerShell.
Can anyone give some good examples or links for such

0 Votes 0 ·

Hi @MSTechie-7364,

Amongst Azure ARM, Biceps or Terraform, which is the best option to choose for IaC for Azure Alerts ?

My recommendation would be to go with Bicep. Also, take a look at these FAQs which talks about the same topic i.e., ARM vs Bicep vs Terraform on Azure.

0 Votes 0 ·

How to create an Azure Alert Rule having more than 1 action group using PowerShell ?

0 Votes 0 ·

Hi ,
we want to automate the creation of Azure Monitor Alerts on Log analytics queries using Azure PowerShell.
Can anyone give some good examples or links for such

0 Votes 0 ·

Hi @MSTechie-7364,

Sure. This Azure document has examples for creating a log alert rule using the PowerShell.

0 Votes 0 ·

This alert should be for the custom Log search query via PowerShell. Which PowerShell command for it

0 Votes 0 ·