az monitor metrics alert create doesn't allow metric names to have certain special characters.
Describe the bug When the metric name has a '/' in it, CLI ignores the / and sends it to API which cause a metric not found error.
To Reproduce az monitor metrics alert create -g anashahRG -n SlowBrowserLoad --scopes /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/anashahRG/providers/microsoft.insights/components/abvarma --description "average browser load time" --condition "avg browserTimings/totalDuration > 125" --window-size 5m --evaluation-frequency 5m --action /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourcegroups/acmetelco2/providers/microsoft.insights/actiongroups/teste --severity 1 on any application insights resource
Expected behavior az monitor metrics alert commands need to allow for '/' in the metric name
Environment summary Install Method = MSI / CLI version = 2.0.46 / OS version = Windows 10 1803 (OS Build 17134.345)/ Shell Type= cmd.exe
Additional context For a list of metric names see this page. Metric names can have ".","/","_" in them.
@tjprescott FYI
@tjprescott What about allowing other special character like '%' and '-' ? --condition "avg Average_% Available Memory >= 90 where Computer includes vm-01"
I get error: line 1:13 token recognition error at: '%' line 1:64 token recognition error at: '-'
I am using 2.0.51 az cli.
Thank you
@snehithm for comment
@tjprescott Sorry for the long delay here.
- Please allow for metric names to have following special characters. Based on metrics list here
- Period
- Underscore
- Hyphen
- Forward Slash
- Backward Slash
- Colon
- Please allow for resource names to have Alphanumeric, hyphen, and period per ARM guidelines
@snehithm @esuparno I've created a PR (#8242) to add support for these special characters. It should be in the next release (end of Jan)