Alert creation for AppInsights fails with “Code”:“ResourceNotSupported”

前端 未结 2 404
星月不相逢
星月不相逢 2021-01-23 14:41

I created an App Insights in Central US region using this script:

New-AzureRmResource -ResourceName $appInsightsName -ResourceGroupName $defaultRgName -Tag @{ Na         


        
2条回答
  •  别那么骄傲
    2021-01-23 15:34

    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.

    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
    

提交回复
热议问题