Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
974 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How can I change just the name of Azure TAG by not touching the value. can this be achieved by Policy ?? Has anyone done this??
Hi vaibhavshete, I think the best option to accomplish this task is by CLI, so You can loop on your resources get the OldTag , create NewTag with the value of the OldTag and finally remove the OldTag. An example on powershell could be:
# Get the resource and tags
$resource = Get-AzResource -Name "RESOURCE_NAME" -ResourceGroupName "RESOURCE_GROUP_NAME"
$tags = $resource.Tags
# Check old tag
if ($tags.ContainsKey("OLD_TAG_NAME")) {
# Store the value of the old tag
$tagValue = $tags["OLD_TAG_NAME"]
# Create new tag with old value
$tags["NEW_TAG_NAME"] = $tagValue
# Update resource with new tags
$resource | Set-AzResource -Tag $tags -Force
# Remove old tag key
$tags.Remove("OLD_TAG_NAME")
# Update resource without old tag
$resource | Set-AzResource -Tag $tags -Force
}
Let me know if this help you. Luis