Open
Description
Description
This is likely an Azure API issue, more than an issue with PowerShell, but I'll just start here in case.
I use Update-AzTag -Operation Replace -Tag @{New=Tags;etc}
to update tags on some Azure resources, mostly to fix casing, remove whitespaces etc. But for certain resource types, the command returns success, but tags does not actually get updated. This is especially aparent when replacing existing tags where only case on tag name has changed. Resource types where I've noticed this kind of behavior:
- Microsoft.Compute/virtualMachines/extensions
- Microsoft.Compute/virtualMachineScaleSets
- Microsoft.DocumentDB/databaseAccounts
- Microsoft.Insights/autoscalesettings
Relevant resources / documentation, confirming these resource types are taggable:
Concrete example:
- Cosmos DB account
Microsoft.DocumentDB/databaseAccounts
with tag@{'Costcenter'=1234}
. - I want to change it to
@{'CostCenter'=1234}
.Update-AzTag -ResourceId $ResourceId -Operation 'Merge' -Tag @{'CostCenter'='1234'}
Update-AzTag -ResourceId $ResourceId -Operation 'Replace' -Tag @{'CostCenter'='1234'}
- Both
-Operation Replace
and-Operation Merge
returns success, but tag stays the same.
Issue script & Debug output
^
Environment data
Name Value
---- -----
PSVersion 5.1.22621.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module versions
Name Version
---- -------
Az.Accounts 2.7.6
Az.Compute 4.26.0
Az.Resources 5.6.0
Error output
No response