In my current project I’ve stumbled upon a problem. We have many ARM templates and need to add tags to all resources. Doing this within templates can be cumbersome, so I’ve created a small VSTS extension that adds tags to all resources within a specific resource group.
The extension can be installed from https://marketplace.visualstudio.com/items?itemName=PeterRombouts.autotagging-extension
The working is pretty simple; enter the values for your subscription, and resourcegroup, and then add the tags.
The tag pairs should be entered, one pair per line, comma separated. The extension will add these tags to all resources in the given resource group, and will not do anything to the existing tags.
Remarks? Please do give feedback! The project is available on Github if you want to contribute!
2 thoughts on “VSTS Extension – Tagging all resources within a Resource Group”
Thanks Peter, this is exactly what I needed for my pipelines.
For me however its not tagging the resource group or my MySQL Db Server and I get 2 warnings about the import module and verb.
“The names of some imported commands from the module ‘AzureRM.Websites’ include unapproved verbs”
The dbsrv error:
Set-TagsOnResource: Error when updating resource /subscriptions/xxxxxx/resourceGroups/RG_xxxxx/providers/Microsoft.DBforMySQL/servers/mysqldatabase-host
Exception setting “Tags”: “The property ‘Tags’ cannot be found on this object. Verify that the property exists and can be set.”.Exception
Still the end result is most of my resources have consistent tags which is really useful. thanks again.
Thanks for your reply Joe! The warnings are default for some of the commands I use, so you can ignore them. The error however is something on my wish list. My extension just tags everything in the resource group, even if it cannot tag that resource.
Improvement would be that I check whether I can tag or not, but did not have the time to add that logic…
Comments are closed.