We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let's say I already have 2 tags:
When running the code:
jsonrtag=$(az resource show -g summerDemo -n demoWebsite --resource-type "Microsoft.Web/sites" --query tags) rt=$(echo $jsonrtag | tr -d '"{},\n' | sed 's/: /=/g') az resource tag --tags $rt expireOn=2019-08-29 -g summerDemo -n demoWebsite --resource-type "Microsoft.Web/sites"
The final result will be 2 tags like this:
The text was updated successfully, but these errors were encountered:
We can also use below script to add tag on each resources from resource group: $group = Get-AzResourceGroup "RGBP-Pipeline" if ($null -ne $group.Tags) { $resources = Get-AzResource -ResourceGroupName $group.ResourceGroupName foreach ($r in $resources) { $resourcetags = (Get-AzResource -ResourceId $r.ResourceId).Tags if ($resourcetags) { foreach ($key in $group.Tags.Keys) { if (-not($resourcetags.ContainsKey($key))) { $resourcetags.Add($key, $group.Tags[$key]) } } Set-AzResource -Tag $resourcetags -ResourceId $r.ResourceId -Force } else { Set-AzResource -Tag $group.Tags -ResourceId $r.ResourceId -Force } } }
Sorry, something went wrong.
Thanks @adeelaleem, excellent idea it's been added to the PowerShell example. in the main ReadMe.md
No branches or pull requests
Let's say I already have 2 tags:
When running the code:
The final result will be 2 tags like this:
The text was updated successfully, but these errors were encountered: