AppInsights的警报创建失败,并显示"Code":"ResourceNotSupported" [英] Alert creation for AppInsights fails with "Code":"ResourceNotSupported"
本文介绍了AppInsights的警报创建失败,并显示"Code":"ResourceNotSupported"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下脚本在美国中部地区创建了App Insights:
I created an App Insights in Central US region using this script:
New-AzureRmResource -ResourceName $appInsightsName -ResourceGroupName $defaultRgName -Tag @{ Name = "AppInsightsApp"; Value = $appInsightsName} -ResourceType "Microsoft.Insights/Components" -Location $defaultLocation -PropertyObject @{"Type"="ASP.NET"} -Force
现在,我正尝试使用以下脚本将警报添加到此App Insights实例:
Now I'm trying to add an Alert to this App Insights instance using following script:
$appInsights = Get-AzureRmResource -ResourceName $appInsightsName -ResourceGroupName $defaultRgName -ResourceType "Microsoft.Insights/Components" -Verbose
Add-AlertRule -Name "Exception Occured" -Description "Exception occured alert" -ResourceGroup $defaultRgName -ResourceId $appInsights.ResourceId -MetricName "Server Exceptions" -Operator GreaterThanOrEqual -Threshold 1 -WindowSize 00:05:00 -CustomEmails "some@email.address" -Location $defaultLocation -RuleType Metric -Verbose
我总是遇到以下错误:
Add-AlertRule : ResourceNotSupported: The target resource id
'/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/resourceGroups/RG-Dev-CentralUS/providers/Microsoft.Insights/components/XXXXXX-appinsights' is not supported.
如何解决此问题?
推荐答案
似乎只能在美国东部创建警报规则.在Azure门户中同样如此-您无法选择位置,但是所有规则都是在美国东部创建的.
It looks like alert rules can be created only in East US. The same in Azure Portal - you cannot select location, but all rules are created in East US.
尝试在Powershell命令中使用美国东部位置:
Try to use East US location in Powershell command:
$appInsights = Get-AzureRmResource -ResourceName $appInsightsName -ResourceGroupName $defaultRgName -ResourceType "Microsoft.Insights/Components" -Verbose
Add-AlertRule -Name "Exception Occured" -Description "Exception occured alert" -ResourceGroup $defaultRgName -ResourceId $appInsights.ResourceId -MetricName "Server Exceptions" -Operator GreaterThanOrEqual -Threshold 1 -WindowSize 00:05:00 -CustomEmails "some@email.addresss" -Location "East US" -RuleType Metric -Verbose
这篇关于AppInsights的警报创建失败,并显示"Code":"ResourceNotSupported"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文