[CI Environment] Do not delete tags that already exist on subscription level#3280
[CI Environment] Do not delete tags that already exist on subscription level#3280ntaheij wants to merge 2 commits intoAzure:mainfrom
Conversation
|
@microsoft-github-policy-service agree |
| $currentTags = $(Get-AzTag -ResourceId /subscriptions/$subscriptionId).Properties | ||
|
|
||
| # Get the tags to remove | ||
| $tagsToRemove = @('Test', 'TestToo') |
There was a problem hiding this comment.
Tags provided by deployment validation tests are just for testing purposes and shouldn't be hardcoded in the CI environment utilities.
If the entire tags object gets deleted even if onlyUpdate is set to true, then I agree that an issue should be opened to address it. @ntaheij could you please open a bug in the board explaining the actual and indended behavior?
There was a problem hiding this comment.
Thanks for the response. Currently, yes, onlyUpdate does delete all tags. Issue is that, when deploying the tests for the module, currently all tags are being deleted, which means tags for i.e. billing are not available. I will open a bug.
There was a problem hiding this comment.
If there is any way to only delete the tags that are created, I'd be interested to use that.
There was a problem hiding this comment.
Thanks @ntaheij! I'm going to put the PR in draft for the moment and reference the PR in the issue
There was a problem hiding this comment.
Note, I replied in the issue :)
Description
Currently, whenever the
Microsoft.Resources/tagsmodule is tested by the CI environment, it will delete the entire tags object, which in most cases, is not desirable.This change gets all the previous tags from Azure and after deletion adds them back without the test tags.
Behaviour:

Pipeline references
Type of Change
Please delete options that are not relevant.
Checklist