Search code examples
azureazure-cliazure-cli2

Azure CLI 2.0: az vm update --set/--remove does not work?


I am attempting to remove and set tags on a VM, but am getting the error unrecognized arguments.

For example, removing a tag:

az vm update –-resource-group MyResourceGroup –-name MyTestVM --remove tags.myNewTagName1

and setting a tag:

az vm update --resource-group MyResourceGroup --name MyTestVM –-set tags.myNewTagName1=myNewTagValue1

Both examples are from the documentation. I'm running v2.0.30 on Mac OS 10.12.x.

Can anyone else confirm this and/or have it work for them? I haven't found any bugs listed in the issues db. Thanks!


Solution

  • I discovered what was wrong. The syntax of the command is correct and works. However, I copied the command out of the documentation and it has a different character for the dashes/hyphens that the AZ CLI does not accept.

    If you copy the samples, just re-type the dashes with the standard ones on your keyboard.

    I had posted it this as an issue here: https://github.com/Azure/azure-cli/issues/5976