Open
Description
Describe the bug
When invoking az
in PowerShell, due to the known issue of PowerShell PowerShell/PowerShell#1995, arguments passed to Azure CLI may get corrupted. For example, literal double quotes ("
) are lost:
# PowerShell
> az '{"signInAudience":"AzureADAndMicrosoftAccounts"}' --debug
Command arguments: ['{signInAudience:AzureADAndMicrosoftAccounts}', '--debug']
This contradicts the behavior of Bash:
# Bash
$ az '{"signInAudience":"AzureADAndMicrosoftAccounts"}' --debug
Command arguments: ['{"signInAudience":"AzureADAndMicrosoftAccounts"}', '--debug']
Impact
This is mainly affecting
- passing JSON as an argument as in
az rest --body {JSON}
(Cannot change the signInAudience using the Microsoft Graph API #15512)# not working az rest ... --body '{"signInAudience":"AzureADandPersonalMicrosoftAccount"}' # working az rest ... --body '{\"signInAudience\":\"AzureADandPersonalMicrosoftAccount\"}'
- using JMESPATH
--query
(az version --query "azure-cli" should return version number and not throw error #13152)# not working az version --query '"azure-cli"' # working az version --query '\"azure-cli\"'
Workaround
See https://github.com/Azure/azure-cli/blob/dev/doc/quoting-issues-with-powershell.md
Activity