Azure / Azure/azure-cli

az resource update interprets string value as mathematical expression

Open
#15,946 1 comment 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 22h
Merged PRs (30d)
64

Description

**Describe the bug**
When using `az resource update` to set tag values, any tag value that appears to be a mathematical expression is interpreted as one, and the result of the expression is stored as the tag value.

For instance, I am trying to set a tag to a date value formatted as "2020-11-16". The string is interpreted as a subtraction, and the tag's value is set to "1993".

Is this the intended behavior? I haven't found any documentation that indicates that it is, and this doesn't happen when using `az resource tag`.

**To Reproduce**
1. Use `az resource tag` to create a new tag with a value of "10-1" on any existing resource (`az resource tag --tags tagName="10-1" -g resourceGroupName -n resourceName --resource-type resourceType --query "tags"`, with the correct parameters substituted)
2. Observe that the tag is correctly set to "10-1"
3. Update the tag's value using `az resource update`, still with the same value of "10-1" (`az resource update --set tags.tagName="10-1" -g resourceGroupName -n resourceName --resource-type resourceType --query "tags"`, with the same parameters substituted)
4. The tag's value will be set to "9" instead of "10-1"

**Expected behavior**
The tag's value is set to the exact string value provided ("10-1" for the above example), or this behavior is noted in the online docs.

**Environment summary**
CLI version: 2.14.2 (installed with apt-get)
OS version: Windows 10 build 19042.630
Shell type: Bash on windows (WSL 1)

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.