Alert-Erstellung für AppInsights schlägt mit "Code" fehl: "ResourceNotSupported"

Ich habe mithilfe dieses Skripts App Insights in der Region Central US erstellt:

New-AzureRmResource -ResourceName $appInsightsName -ResourceGroupName $defaultRgName -Tag @{ Name = "AppInsightsApp"; Value = $appInsightsName} -ResourceType "Microsoft.Insights/Components" -Location $defaultLocation -PropertyObject @{"Type"="ASP.NET"} -Force

Jetzt versuche ich, dieser App Insights-Instanz einen Alert mit folgendem Skript hinzuzufügen:

$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 "[email protected]" -Location $defaultLocation -RuleType Metric -Verbose

Und ich erhalte immer folgende Fehlermeldung:

Add-AlertRule : ResourceNotSupported: The target resource id
'/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/resourceGroups/RG-Dev-CentralUS/providers/Microsoft.Insights/components/testkktest-appinsights' is not supported.

Wie kann ich dieses Problem beheben?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage