azure-cli
azure-cli copied to clipboard
"az vm user update" fails in PowerShell if new password contains ampersand
Describe the bug
Command Name
az vm user update
Errors:
After printing the first JSON blob for enablevmaccess, the console writes
'foo' is not recognized as an internal or external command, operable program or batch file.
where foo is the part of the new password after the ampersand. It seems that the shell is interpreting the ampersand and trying to run the remaining part as a command.
To Reproduce:
az vm user update -n $vmName -g $resourceGroup -u $userName -p $newPwwhere$newPwcontains an&character
Expected Behavior
Password should be changed successfully.
Environment Summary
Windows-10-10.0.18362-SP0 (build 1903)
Python 3.6.6
Shell: powershell.exe (5.1.18362.113)
azure-cli 2.0.65 (installed via MSI)
Additional Context
You need to escape the & character because it is interpreted by the Powershell shell before it ever reaches the CLI. There is nothing that can be done in the CLI about this.