Azure / azure-cli

Azure Command-Line Interface
MIT License
3.92k stars 2.89k forks source link

az monitor action-group create requires --tags with whitespace to be surrounded by single quotes unlike other commands #29117

Open r300mrg opened 1 month ago

r300mrg commented 1 month ago

Describe the bug

The command "az monitor action-group create requires" requires the --tags Name to be surrounded by single quotes (double quotes do not work), however other Azure CLI commands do not need single quotes and double quotes work.

This then creates inconsistencies in code when using Azure CLI commands. If single quotes are added to the other non-required Azure CLI commands, the single quotes are populated within the Name of the Tag.

Related command

This commands fails with the error below:

az monitor action-group create \ --subscription "$SUBSCRIPTION_ID" \ --resource-group "$RESOURCE_GROUP" \ --action-group-name "$GROUP_NAME" \ --group-short-name "$GROUP_SHORT_NAME" \ --location "Global" \ --tags "Technical Owner"="$TAG_TECH_OWNER" "Environment"="$TAG_ENV"

This amended command works with the single quotes surrounding the tag.:

az monitor action-group create \ --subscription "$SUBSCRIPTION_ID" \ --resource-group "$RESOURCE_GROUP" \ --action-group-name "$GROUP_NAME" \ --group-short-name "$GROUP_SHORT_NAME" \ --location "Global" \ --tags "'Technical Owner'"="$TAG_TECH_OWNER" "Environment"="$TAG_ENV"

However, other Azure CLI commands do not have this issue and do not require single quotes to be included: e.g. az monitor scheduled-query create \


--tags "Technical Owner"="$TAG_TECH_OWNER" or az functionapp create \


--tags "Technical Owner"="$TAG_TECH_OWNER"

Errors

Creating/Updating Action Group: ERROR: Failed to parse '--tags' argument: Shorthand Syntax Error: Please wrap whitespace character in single quotes: Technical ^

Issue script & Debug output

Creating/Updating Action Group: ERROR: Failed to parse '--tags' argument: Shorthand Syntax Error: Please wrap whitespace character in single quotes: Technical ^

Expected behavior

Consistency across Azure CLI commands and double quotes to work without the need for single quotes.

Environment Summary

azure-cli 2.61.0

core 2.61.0 telemetry 1.1.0

Extensions: azure-devops 1.0.1

Dependencies: msal 1.28.0 azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3' Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.11.8 (main, May 16 2024, 03:47:28) [GCC 11.4.0]

Additional context

No response

yonzhan commented 1 month ago

Thank you for opening this issue, we will look into it.