Azure-cli: azure cli commands automatically appends git-bash path in the parameter that contains forward slash

Created on 9 Jul 2020  路  5Comments  路  Source: Azure/azure-cli

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug
While executing a azure cli command (in bash shell) that expects parameter called --scope with fully qualified name. When i pass the parameter value which starts with forward slash e.g. '/subscriptions/70c-xyz-35ac-/resourceGroups/rg-test-001/...' during execution time the actual value is replaced with 'C:/program files/Git/subscriptions/70c-xyz-35ac-/resourceGroups/rg-test-001/...', due to this additional path in front of the param value, the command is throwing exception like Property id at path 'properties.scopes[0]' is invalid...

To Reproduce
az monitor metrics alert create \
--name "dbalert-highCPU-001" \
--scopes "/subscriptions/xyz/resourceGroups/rg-test-001/providers/Microsoft.DBforPostgreSQL/servers/psql-test" \
--condition "avg cpu_percent > 90" \
--description "High CPU" \
--window-size 5m \
--evaluation-frequency 1m

Expected behavior
No additional path should be appended in front of the parameter value during CLI execution in bash shell.

Environment summary
OS version - Windows 10
Shell Type - Bash on Windows

Additional context
cli_path_issue

Core Infrastructure Shell

Most helpful comment

This is a known issue of Git Bash that it translates a resource ID like /subscriptions/xyz/resourceGroups/rg-test-001/providers/Microsoft.DBforPostgreSQL/servers/psql-test to a Windows path, thus corrupting Azure CLI commands. (https://github.com/Azure/azure-cli/issues/6545#issuecomment-644025439)

Please see Use Azure CLI with Git Bash for more details.

All 5 comments

add to S173

@spatialman Hey. I think it's not an issue for Azure CLI. It should be an issue for git bash. @jiasli @zhoxing-ms Please confirm

This is a known issue of Git Bash that it translates a resource ID like /subscriptions/xyz/resourceGroups/rg-test-001/providers/Microsoft.DBforPostgreSQL/servers/psql-test to a Windows path, thus corrupting Azure CLI commands. (https://github.com/Azure/azure-cli/issues/6545#issuecomment-644025439)

Please see Use Azure CLI with Git Bash for more details.

Thanks for the workaround...

Since we have workaround, i am closing this issue...

Was this page helpful?
0 / 5 - 0 ratings