Azure-cli: az vm update - az: ' vm update --resource-group' is not in the 'az' command group.

Created on 7 Feb 2019  路  12Comments  路  Source: Azure/azure-cli

Describe the bug
Running az vm update commands fails for my customer in multiple clients including Cloud Shell.

"az vm list" and other commands seem to work, but no az vm update commands are successful.

Two different "az vm update" commands fail with the error below:

To Reproduce
We ran the following command:
az vm update --resource-group RGName --name VMName --set tags.test=tags
az: ' vm update --resource-group' is not in the 'az' command group. See 'az --help'.

Another example with --debug is attached.
az vm update debug Log.txt

Expected behavior
It's expected that the command completes successfully. I do not have an issue in Cloud Shell, and the customer has one On Prem client that does not have an issue, but in his Cloud Shell and multiple other machines in Azure, they all get the errors above.

Environment summary
All machines are using version 2.0.56, aside from one on 2.0.57. I am on 2.0.56 and do not have the issue.
Affected machines are Windows 2012 and various versions of Linux. It spears that all Azure VM's have the issue.

Additional context
Out of the machines we checked, the only one without the issue is the On-Prem Windows 10 machine. Cloud Shell run from that machine fails as well.

Compute-cli question

Most helpful comment

You were right. Typing it in manually resolved the issue.

Thanks for the help, the behavior made no sense to me!

All 12 comments

From the debug trace, there is clearly an encoding issue on the affected machines. The terminal is sending the unicode character \xa0 instead of a plain space. Does this issue only occur for this one command or do other commands show this problem?

We originally had the issue with the command in the txt document to swap the disk with another VHD.

In testing we also had the issue with the command mentioned to create a tag on the VM.
az vm update --resource-group RGNAme --name VMName --set StorageProfile.OsDisk.Vhd
and
az vm update --resource-group RGName --name Name --set tags.test=tags

It also did not matter if we used "--resource-group and --name" or "-g and -n". Same result.

Are you running these commands from a script? Or copy-pasting from another document?

These are just written in notepad, then copied in.

And if you type them directly?

I can't say for sure if that was successful as my customer is currently away, however copying the same command into his on-prem Windows 10 client works without issue.

That one machine works, but no azure VM's or Cloud Shell are successful.

Also, other commands such as "az vm list -g RGName" run successfully on the affected machines. Just no az vm update commands.

@montyleew, I looked at your "debug.txt" file and saw that some of the spaces are actually "\xa0" characters which is the hexadecimal value "A0". This character is a "Non-breaking space" character, which in certain scenarios is treated differently from other whitespace characters, which is probably why the shell does not treat it as whitespace when breaking the command into its individual tokens yielding:

['\xa0 vm \xa0 update \xa0 --resource-group', 'RGNAme \xa0 --name', 'VMName \xa0 --set \xa0 StorageProfile.OsDisk.Vhd.Uri=https://SAName.blob.core.windows.net/vhds/VMName-OS-1.vhd', '--debug']

As you can see, the Non-break-space characters are treated as part of each token instead of whitespace, if they were regular whitespace, the correct tokens would have been parsed.

Is the customer copying and pasting this command from html or some other document?

Yes, this is being copied from Notepad.
I did copy that text from my notes as well, so I'm not sure if those were added afterwards.

I'll have him type this in directly and report back.

I appreciate the help!

That's interesting, out of curiosity, were these commands typed into notepad or copied from elsewhere?

I'll find that out for us. The customer appears to be offline.

I'm trying to find out if the characters were added when I copied the results from the customer out of Outlook. I don't see them here.

You were right. Typing it in manually resolved the issue.

Thanks for the help, the behavior made no sense to me!

Hi @montyleew when copying from any document, I'd recommend you copy first to something like Notepad++ and use something like their "Convert to UTF-8" option.

Was this page helpful?
0 / 5 - 0 ratings