Azure PowerShell Add-AlertRule returns an invalid request when using CpuPercentage in a resource group

I get an Azure resource group and try to add a Metric Alert rule of type CPUPercentage, but it does not work with BadRequest.

> $r = Get-AzureRmResourcegroup
WARNING: The output object of this cmdlet will be modified in a future release.
> $a = $r[0]
> Add-AlertRule -Location "West US" -MetricName CpuPercentage -Name CPU98Percent -Operator GreaterThanOrEqual -ResourceGroup $a.ResourceGroupName -ResourceId $a.ResourceId -RuleType Metric -Threshold 98
Add-AlertRule : BadRequest:
At line:1 char:1
+ add-alertrule -Location "West US" -metricName CpuPercentage -Name CPU ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-AlertRule], CloudException
    + FullyQualifiedErrorId : Hyak.Common.CloudException,Microsoft.Azure.Commands.Insights.Alerts.AddAlertRuleCommand

It works great with the portal. There is no longer an alert with the same name. I am using version 1 of the Azure module and version 1.0.2 of AzureRM.

+4
source share
1 answer

, Sql. , , "DTU Percentage", . , ( "DTU Percentage DB_NAME" ), .

, , . , , .

+1

Source: https://habr.com/ru/post/1614982/


All Articles