CAUTION - overwrites existing tags on resource.
foreach ($r in (Get-AzResource -ResourceGroupName YOUR_RG_NAME)){ Set-AzResource -Tag @{myTag="MyValue"} -ResourceId $r.ResourceId -Force }
UPDATE : remove tag while leaving other intact
Get-AzResource -TagName "MyTagKey" | % {
$_.Tags.Remove("MyTagKey")
$_.Tags
Set-AzResource -ResourceId $_.ResourceId -Tag $_.Tags -Force
}
No comments:
Post a Comment