Building your Azure tag system

Building your Azure tag system

April 21, 2020 0 By Cezary Oltuszyk

Organizing cloud-based resources is one of the most important tasks for IT professionals working with Cloud Environment. The three main tools that make this work much more effective are: Azure Subscriptions, Naming Convention and Tagging.

In this article, I’m going to show you how to create a good resource tagging system, which will be a solid foundation for accounting, automation and pro-active cost management in future.

What is tagging?

Tags provide a way to describe your resources, with properties that you define. It is a very powerful tool for extending your management options with new capabilities.

The easiest way of adding the tag is to use Microsoft Azure Portal. After login, navigate to the resource and open the Tags pane (the red border) to add new values:

On the screenshot above you can see that I added a tag Environment with a value Test (green border) for my vm-coltuszyk virtual machine.

There is a limit of 15 tags per resource, so you need to consider that.

Tagging categories

When you know how to add tags to resources, the next question is how to create a reliable tagging system.

The first step within your Azure environment is to identify the future tasks that you wish to assign, and group them into categories. This task can be quite difficult if you’re just getting started with Azure so I would suggest following the categories outlined below:

Category nameCategory description
TechnicalUsed for basic technical information, such as resource geographical location or whether this resource is a production or test.
AutomationThey help you apply bulk actions to related resources automatically, e.g. “shut down all VMs with the tag Environment: dev overnight”.
Accounting Allows a resource to be associated with specific clients/groups/projects within an organization for billing purposes. Those tags are included in cost management reports.
SecurityUsed for Regulatory Compliance and Data Classification.
BusinessExtends resources with business information like application name or contact pearson.

This is a great start point to creating a functional tag system.

Tag names

The second step is extending tag categories with real tag names that will be useful for you. Let’s take a look at Business category as an example.

Create AppName tag, and assign a value depending on the  purpose of the current resource. On the screenshot below you can see that I added AppName tag for my virtual machine with a CallCenterApp value:

From this point this information will be present as a property of our virtual machine, which is a big step forward in organizing Azure resources. You can see this information in the portal, but also in other tools like Azure PowerShell, billing reports, etc.

Of course this example shows only one tag for one category. You need to extend all five categories with tags to make a complete tag system (remember about the 15 tags per resource limit).

I prepared an Excel draft with my suggestion of a ready to use tag system.  You can download it from this link.

Using the tags

Using the tag system will make your IT professional life much easier. Here you can see an exported billing report for one of my test subscriptions.

The tags are present in one of the columns, so with good Microsoft Excel skills you can filter the resource with a specific application name, and easily make cost summaries for your accounts.

Filtering resources by tags in the PowerShell is not so difficult either. You just copy the following code and you are done!

Get-AzResource -Tag @{AppName="CallCenterApp"}

Now you can see a resource list with CallCenterApp application name.

Summary

Having a good resource tagging system is essential when managing large cloud infrastructure. Especially when you want to set up Azure resources correctly the first time, then you will see the benefits of the tag system. Paying attention to correct tagging will be of benefit when carrying out more complex tasks, such as cost accounting or automation. After all, it is much nicer to produce a simple statement of resources with one command, than to keep clicking for several days to get the same information.