Azure PowerShell Add-AlertRule在资源组上使用CpuPercentage时返回错误请求

Tyl*_*Ham 5 powershell azure

我得到一个Azure资源组并尝试添加类型为CPUPercentage的度量标准警报规则,但它失败并带有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
Run Code Online (Sandbox Code Playgroud)

它从门户网站正常工作.还没有具有相同名称的警报.我正在使用Azure模块的第1版和AzureRM的1.0.2版.

Don*_*art 2

当警报名称在 Sql Server 上的所有数据库中不唯一时,我收到相同的错误。也就是说,我在同一台服务器上有多个数据库,并尝试创建名为“DTU Percentage”的规则,该规则在创建第一个数据库后会失败。使用唯一名称(“DTU 百分比 DB_NAME”)后,就会创建警报。

不幸的是,听起来您遇到了另一个问题。只是想我会为任何搜索类似错误的人添加这个答案。