-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Labels
Service AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.Shell - PowerShellcommon issue
Milestone
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
SamHasler, gtbuchanan and cveld
Metadata
Metadata
Assignees
Labels
Service AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.Shell - PowerShellcommon issue