Reputation: 9494
I've created a script to add alert rules to several Azure resources (web apps, SQL databases, and cloud services). Everything works except for creating the cloud service alerts which returns an error:
Add-AlertRule : ResourceProviderNotSupported: The resource provider 'Microsoft.ClassicCompute' is not supported.
This is the script I'm using to add the rule:
$cloudServices = Get-AzureResource -ResourceType "Microsoft.ClassicCompute/domainNames" -ResourceGroupName $resourceGroup
Foreach ($cloudService in $cloudServices)
{
# Cloud Service - CPU Percentage
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've tried other using a different ResourceType
parameter to target the role instead of the cloud service, but that doesn't work either.
Has anyone had any experience scripting these cloud service alerts successfully?
Upvotes: 4
Views: 770
Reputation: 2206
Hi Garrett sometime back I had created same kind of stuff without any issues. Please have a look on this link-
Upvotes: 1