I created a script to add alert rules to several Azure resources (web applications, SQL databases, and cloud services). Everything works, except for creating cloud service alerts that return an error:
Add-AlertRule: ResourceProviderNotSupported: The resource provider "Microsoft.ClassicCompute" is not supported.
This is the script that I use to add the rule:
$cloudServices = Get-AzureResource -ResourceType "Microsoft.ClassicCompute/domainNames" -ResourceGroupName $resourceGroup
Foreach ($cloudService in $cloudServices)
{
Add-AlertRule `
-RuleType Metric `
-Name "CPU Percentage (Cloud Service)" `
-Location $cloudService.Location `
-ResourceGroup $cloudService.ResourceGroupName `
-Operator GreaterThan `
-Threshold 75 `
-WindowSize 01:00:00 `
-ResourceId $cloudService.ResourceId `
-MetricName "Percentage CPU" `
-TimeAggregationOperator Average `
-SendToServiceOwners
}
I tried using a different parameter ResourceTypeto target the role instead of the cloud service, but this does not work either.
Does anyone have experience with these cloud services?
source
share