Azure PowerShell Add-AlertRule Returns Bad Request when using CpuPercentage on Resource Group

Question:

I get an Azure Resource Group and try to add a Metric Alert rule of type CPUPercentage, but it fails with BadRequest.

It works fine from the portal. There isn’t already an alert with the same name either.
I’m using version 1 of the Azure module and version 1.0.2 of AzureRM.

Answer:

I was receiving the same error when the alert name was not unique across all databases on the Sql Server. That is, I had multiple databases on the same server and was trying to create a rule named “DTU Percentage”, which would fail after the first one was created. Once a unique name (“DTU Percentage DB_NAME”) was used, the alerts were created.

Unfortunately, it sounds like you are experiencing another issue. Just thought I would add this answer for anyone searching for similar errors.

Source:

Azure PowerShell Add-AlertRule Returns Bad Request when using CpuPercentage on Resource Group by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply