Tags are an important construct that have been part of my IT practice for years. I based a lot of my on-premises virtualization expertise on tags, and it really allowed me to address things like scale, policy, ownership and more.

It’s great to see that Azure has a tag construct as well, but we should make sure we understand what an Azure tag is and answer my three main points: How to use them, Why use them and Where to use them. Let’s first define the Azure tags. The docs site explains Azure tags as: “You apply tags to your Azure resources giving metadata to logically organize them into a taxonomy. Each tag consists of a name and a value pair.”

This is a good setup to the tag idea, and right in the docs site they recommend “auto-tagging” – which I 100% agree with. This is easy to do when you deploy through scripts along with new resources being deployed (example will be shown below) or in the Azure portal.

Why use Tags

You can keep your cloud practice organized. Think of things as simple as production vs. development. The Azure account I will show you is entirely test-dev, so I can do fun stuff, but give your real Azure account some consideration here. Ownership, to-be-retired, application, line of business and other technical and business drivers can be tag material.

Where to use Tags

The important first point to note is that not all Azure services support tags. Most of the services I use and want to have tags indeed support tags.

How to use Tags

The first thing to do before applying tags is to give some good, thorough thought to a nomenclature that will be clear for your organization. In fact, I would recommend you draw that up before doing anything with tags. Having completely irrelevant tags like “sample tag” or “tag1” are more confusing than helpful. Same goes to any Star Wars references.  There are really two ways to use tags, I’ll do one here each way in one thorough the portal and one through PowerShell in Azure.

Unique to Azure, tags are set and created at the base of the resource. So, let’s look at a storage account I have and create a tag for it. Those of you who know me know that I do a lot around using backup data in Azure blog storage. Here you can see that the rwv0blob0backupdata storage account has a tag applied to it:

Tags. You know you need to.

I’ve noted that this storage resource is a beta-install. So, the tag here is “blob-based-backup-storage” and the value I gave to this storage account is “beta-install”. The other storage account has the same name “blob-based-backup-storage” but has a “production-install” value, making it easy for me to know which one I can manipulate (even in this test-dev account). Over on the right, you can see that you can delete the tag or see what resources are assigned to it. Note that any changes in the Tags configuration of an Azure resource require you to select save at the top.

I’m going to delete that tag and re-assign it with a small change, but this time via PowerShell. The doc link above has a very good outline of PowerShell usage for Azure tags, but I made a slightly different name, but the same value:

Set-AzResourceGroup -Name
Default-Storage-CentralUS -Tag @{ blobfarm ="beta-install"; }

This results in the following:

You can script things in Azure too.

Azure tags are the start of something big, and I really encourage Azure administrators to apply tags everywhere, consistently, and with good nomenclature. I’d even go so far to say that if there is a resource that is not tagged, you may want to remove it.

Do you use Azure tags? If so, how, where and why? Share your comments below.

Advertisements