Assigning tags to MS Azure resources is essential to creating a well-organized and transparent taxonomy in your cloud and achieving significant cloud cost optimization. When it’s done correctly, this practice can provide a consistent basis for applying universal business policies across the organization and, most importantly, for tracking cloud spending with the help of your cloud cost management tools.
There can be certain challenges in implementing a cost-efficient and well-balanced strategy to handle resources, so the brief instructions provided in this article should help you navigate in the cloud along the main guidelines and leverage the best practices for the MS Azure platform.
MS Azure tags are name-value pairs that are used to specify additional metadata as a property of the object, logically group resources and provide a better overview of a given cloud account. Tags can be applied to individual resources that were created with the help of Azure Resource Manager or, generally, to the whole resource group that they are part of. The tagging is done on the Azure platform level which does not impact the performance of the associated resources in any way, and the service is also free of charge.
The tags as name-value pairs can be anything that helps identify the class that a specific resource is supposed to belong to. For example, a resource tag key could be set as “Department,” and the value as “Engineering.” Although these can be modified at any time, it’s better to apply tags consistently during the resource creation stage to avoid any confusion and additional overhead associated with their optimization. This way, you will be able to easily sort your resources in the Azure portal using the tags to get a quick view of all of the resources that come under various departments, budget pools, production environments, etc.
Once a tag is created and assigned to a resource, it will be reflected in the periodical Azure usage report, which is available in the CSV format from the Account Management Portal. This report is intended to provide insights into the costs that have been incurred by the tagged resources and help analyze the metrics further by sorting the resource usage based on tags.
Rules to implement correct tagging strategy in MS Azure environment
Although adding tags to Azure resources is very simple, there are certain rules and limitations that the user should be aware of:
- There is a maximum of 15 tags that can be associated with a resource (VM, Network, etc.) or resource group.
- Resources must be deployed using the ARM model (Azure Resource Manager) in order to be able to use tags; ASM resources (deployed with the classic deployment model) are not supported and have to be redeployed through Resource Manager to be able to apply tags on them.
- Only alphanumeric characters can be used for tags.
- The maximum number of characters for a tag name is 512. For storage accounts, this is limited to 128 characters. Not case-sensitive.
- The maximum number of characters for a tag value is 256. Case-sensitive.
- The built-in contributor role (or the contributor role for a specific resource) must be used when applying tags.
- There is no inheritance hierarchy for tags meaning that tags applied at the resource group level are not inherited by their members.
- The tag name prefixes “Azure,” “Windows,” and “Microsoft” are reserved and cannot be used.
- Once a tag is created and applied to a resource, it is automatically added to the subscription-wide taxonomy.
How to apply a tag to your MS Azure resource
There are several ways to apply a tag to your Azure resource. For this example, let’s say there is a VM that requires tagging.
In MS Azure console navigate to the Virtual machines section in the left sidebar and select the VM from the list to access its overview.
Once redirected, find the “Tags” menu option on the left and click on it. You will see two free form input boxes that correspond to tag’s Name and tag’s Value. Fill in these fields and click “Apply” to save the result.
This action will create a tag that will be available across your Azure subscription. So when you access another resource’s Tags section, you will be able to choose from the list of existing tags.
In order to get a convenient overview of the applied tags, click on Manage View → Edit Columns → Add Column → Tags → Save
There will appear a new column for Tags that allows for quick access and editing opportunities for the listed resources. Click on the corresponding tags to open their pages and modify name/values.
Additionally, you can use the search box at the top to discover the existing tags. Type in Tags to be redirected to the Tags section (located under Services). If you select any tag there, a list containing all resources that this tag has been applied to will be shown on a new page.
Tagging system is an essential part of an effective cloud management process. It is designed to bring visibility into MS Azure costs and usage patterns, that helps achieve cloud cost optimization goals.