Azure / Azure/azure-cli

tags with periods/dots are not supported for az vm update command

Open
#8,103 9 comments 0 reactions 2 assignees Claimed by @zhoxing-ms View on GitHub
act-observability-squad act-platform-engineering-squad Compute Core feature-request Infrastructure
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Describe the bug**
the tag for GuestOS Enablement cannot be set via az vm update command as it contains a period "platformsettings.host_environment.enableprocessorspeculationcontrol"

The issue was because the key has periods/dots(“.”) within it. So for example:

$ az vm update -n -g --set "tags.foo=true"

works as expected. A tag “foo” with value “true” is added.

However if we attempt:

$ az vm update -n tosin-vm-debian -g ova-test --set "tags.foo.bar=true"

The command fails with this error:

Couldn't find 'bar' in 'tags.foo'. 'tags.foo' does not support further indexing.

This error is because the update command uses dots to index into nested fields (such as networkProfile) of the JSON representation of the VM.

**To Reproduce**
see above

**Expected behavior**
expect this command to succeed and add the tag
az vm update -g -n --set tags.tagName="platformsettings.host_environment.enableprocessorspeculationcontrol=true"

**Environment summary**
Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (`az --version`) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.