az tag create treating array as string for --tags
See original GitHub issueThis is autogenerated. Please review and update as needed.
Describe the bug
When creating an array of tags within powershell to pass to --tags, it treats it as a single string instead of an array. This is a new bug in 2.40 as we have tested the functionality within 2.39
Command Name
az tag create
Errors:
(InvalidTagValueLength) Tag value too large. Following tag value '**output from tags array**' exceeded the maximum length. Maximum allowed length for tag value - '256' characters.
Code: InvalidTagValueLength
Message: Tag value too large. Following tag value '**output from tags array**' exceeded the maximum length. Maximum allowed length for tag value - '256' characters.
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information. Create an array for tags such as: $tags = @( “cdo:cost:business-unit=Planning and Operations”, “cdo:cost:primary-segment=Planning and Operations”, “cdo:cost:secondary-segment=Something”, “cdo:cost:csr-name=Some long name”, “cdo:cost:customer-name=TestClient”, “cdo:cost:primary-function=RnD”, “cdo:cost:secondary-function=Product Development”, “cdo:cost:region=Corporate”, “cdo:cost:market=Corporate”, “cdo:cost:environment=Development”, “cdo:cost:stage=Development”, “Function=Spoke”, “Client=TestClient”, “Environment=Production”, “Role=AA”, “Package=1234.1.123” )
Then pass this using az tag create --resource-id {} --tags $tags --output none
- Put any pre-requisite steps here…
az tag create --resource-id {} --tags {} --output {}
Expected Behavior
Tags are treated individually rather than treating the first tag up to ‘=’ as the key, and then the rest as the ‘value’ which exceeds the 256 limit.
Environment Summary
Windows-10-10.0.19042-SP0
Python 3.10.5
Installer: MSI
azure-cli 2.40.0
Extensions:
account 0.2.3
interactive 0.4.5
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Additional Context
Issue Analytics
- State:
- Created a year ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
Yes, that’s fine. It makes sense, we splat params all the time, so not sure why we did a powershell array for this, but if it accepted it i guess we never questioned it 😃 Please close.
Thanks. I have done a test now and yes, this has fixed the issue by changing it to a splat instead. I will update the team so knowledge is shared as this might break other areas of our deployments.