Fix update test resources tagging when tags are empty. Bump max limit#7171
Fix update test resources tagging when tags are empty. Bump max limit#7171benbp merged 1 commit intoAzure:mainfrom
Conversation
|
The following pipelines have been queued for testing: |
| Log "Updating DeleteAfter to '$deleteAfter'" | ||
| Write-Warning "Any clean-up scripts running against subscription '$SubscriptionId' may delete resource group '$ResourceGroupName' after $DeleteAfterHours hours." | ||
| if (!$resourceGroup.Tags) { | ||
| $resourceGroup.Tags = @{} |
There was a problem hiding this comment.
This is actually necessary? Seems more like a bug on the Az PowerShell module. As a workaround, though, I see no harm but if it is a bug, we should make sure it's reported. PowerShell is truthy, so idiomatically so should cmdlets be.
There was a problem hiding this comment.
It's all json at the API level so I'm not surprised if the underlying value was null that powershell just converted it to $null without initializing empty values?
There was a problem hiding this comment.
That's my assumption as well...but should. If the value is falsy, it should omit the tags in the request or pass an empty object - whatever the control plane requires in that case.
There was a problem hiding this comment.
The issue here is we try to index into $null a line below, not that we're submitting bad API data.
There was a problem hiding this comment.
Ah, I see. Thanks for the clarification. That said, does sending whatever @{} serializes into cause problems?
There was a problem hiding this comment.
It worked when I tested it out. The response object is also a hashtable:
$ $g[0].Tags.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Hashtable System.Object
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#7171 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow) Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
No description provided.