Hello @SwathiDhanwada-MSFT
thank you, I checked my code again and I accidentally passed a wrong resource Id to the Add-AzMetricAlertRuleV2 call.
It is working now.
Adding Azure WebApp Alert via Powershell Add-AzMetricAlertRuleV2 "Couldn't find a metric"
I am trying to create alerts for an Azure WebApp using Powershell and the Add-AzMetricAlertRuleV2 call.
While some alerts are created successfully (e.g. RequestsInApplicationQueue) all Metrics starting with "Http" cannot be found:
HttpResponseTime, Http5xx, Http4xx, Http401, Http403, Http404, Http406
I checked if they are available using Get-AzMetricDefinition -MetricNamespace "Microsoft.Web/sites", and the metrics are listed as available there.
However, when I execute Add-AzMetricAlertRuleV2, for all Http* metrics, I get
Exception type: ErrorResponseException, Message: Couldn't find a metric named Http5xx. Make sure the
| name is correct. Activity ID: 36cffdfc-2d44-4b02-9d2c-1dc07b97cae1., Code: BadRequest, Status
| code:BadRequest, Reason phrase: BadRequest
Is this a bug in the Powershell Az Module?
-
Erik Stach 96 Reputation points
2021-08-03T09:46:48.52+00:00