While attempting the creation of a metric alert for a storage account using the code below
$windowSize = $(New-TimeSpan -Minute 5)
$operator = 'LessThan'
$threshold = 100
$resourceId = '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Portal-Resources-1/providers/Microsoft.Storage/storageAccounts/xxxxxxxxxx'
$metricName = 'Availability'
$timeAggregationOperator = 'Total'
$location = 'westeurope'
$description = 'Warning'
$resourceGroup = 'Portal-Resources-1'
$name = 'Availability xxxxxxxxxx'
Add-AzureRmMetricAlertRule `
-WindowSize $windowSize `
-Operator $operator `
-Threshold $threshold `
-TargetResourceId "$resourceId" `
-MetricName $metricName `
-TimeAggregationOperator $timeAggregationOperator `
-Location $location `
-Description $description `
-ResourceGroup $resourceGroup `
-Name $name
I get the error stating
Add-AzureRmMetricAlertRule : Exception type: ErrorResponseException, Message: The metric with namespace '' and name 'Availability' is not supported for this resource id '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Portal-Resources-1/providers/Microsoft.Storage/storageAccounts/xxxxxxxxxx.,
Code: UnsupportedMetric, Status code:BadRequest, Reason phrase: Bad Request
It seems to me that the error stems from the use of an incorrect metric name. But according to the documentation on this page https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftstoragestorageaccounts.
Availability is a supported metric for storage accounts.
What could be causing this error?