Adding tags to resources in Microsoft Azure

In this article you will learn how to add tag to single resource, whole resource group, delete tags and search for resources by tag within Azure.

Crete new resource group from cloud shell with this command:

az group create ` --name tagrg ` --location westeurope

In next step add VM into the resource group with this command.

az vm create ` --name vmtag1 ` --resource-group tagrg ` --image Win2019Datacenter ` --location westeurope ` --admin-username adam` --admin-password Pass!

Then add new tag from resource group.


From resource group Overview select all resource and assign the same tag to them.Tag with name env and value prod will be assigned to all resources within your resource group.

Now you can go to any resource and make sure the tag is visible there.



Next got to all services and search for Tags. You will see a list of all available tags you created. Click on the tag env:prod. That will display all resources with this tag.

Finally if you do not want tag to be associated with one of your resources you can simply remove it. Select any resource from the resource group tagrg, go to Tags section and click delete all or trash icon next to tag.





Comments

Post a Comment