question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az tag create treating array as string for --tags

See original GitHub issue

This 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:closed
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jrvevacommented, Sep 20, 2022

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.

1reaction
jrvevacommented, Sep 20, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use tags to organize your Azure resources and management ...
The az tag create replaces all tags on the resource, resource group, or subscription. When you call the command, pass the resource ID...
Read more >
Assigning multiple tags to a resource via Azure CLI results in ...
If you want to create multi-tag to one VM, you should add the parameter --tags like this: --tags 'tag1=test1' 'tag2=test2'.
Read more >
strip_tags - Manual - PHP
This function tries to return a string with all NULL bytes, HTML and PHP tags stripped from a given string . It uses...
Read more >
Liquid filters: array filters - Shopify.dev
You can't use the reverse filter on strings directly. However, you can use the split filter to create an array of characters in...
Read more >
Array Tags | Historian 8.0 Documentation | GE Digital
You cannot associate an Enumerated Set to an array tag. Fixed String and Scaled data types are not supported. You cannot make an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found