Cannot create custom metric alert via azure cli.
See original GitHub issueNote: this pertains to https://docs.microsoft.com/en-us/cli/azure/monitor/metrics?view=azure-cli-latest#az-monitor-metrics-list-definitions and https://docs.microsoft.com/en-us/cli/azure/monitor/metrics/alert?view=azure-cli-latest#az-monitor-metrics-alert-create
Describe the bug I ran
$aiid = "/subscriptions/CENSORED/resourceGroups/CENSORED/providers/microsoft.insights/components/CENSORED"
az monitor metrics list-definitions --resource $aiid
and expected to see my custom metric definitions (in custom namespaces), but didn’t found any custom metrics.
To Reproduce
Log a custom metric from the source code using ApplicationIsnights. Observe you can create an alert using it it via azure portal, or view it in metrics view in AI. However, it is not listed via list-definitions
, nor you can create an alert via Azure CLI using it, as it is not found.
Expected behavior
The custom metric (and its namespace) to be listed, and accepted when creating an alert with az monitor metrics alert create
.
Environment summary
az --version
azure-cli 2.0.66
Additional context Confirmed the custom metrics also cannot be found via
Get-AzMetricDefinition -ResourceId $aiid
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (13 by maintainers)
If you pass an empty string to -DynamicThreshold it lets you create the criteria unfortunatelly when you create the alert rule it comes with static “default” threshold.
Hi @konrad-jamrozik , @pajzo, thanks for reporting this. We are looking into this.