Resource tagging in Azure is a critical function which many organizations do not fully take advantage of. In this article I will cover what tags are, the core benefits of tagging, and some general suggestions on how to approach tagging.
For those that have not read it yet, I recently published an article titled Foundations of Azure Governance which laid the groundwork for my starting point when discussing Azure implementations and governance with clients. One of those core foundational areas is tagging, and there may be some benefit to reading the foundational overview first so that you can consider how tagging fits in with the other foundations before reading the greater detail here.
Tagging Overview: What are tags?
Simply put, tags provide a way to apply metadata to your resources. The tags are naturally unstructured and it can be used to create a taxonomy that can be flexible and evolve over time. They are simple name/value pairs that are user defined and can be set to whatever the editors wants.
Here are some simple examples:
Key Notes and Boundaries:
- Both the name and value are free form text, spelling is important
- Tag Name limited to 512 characters
- Tag Value limited to 256 characters
- Tag names can’t contain these characters:
- Tags are shared within a subscription (subscription boundary)
- Maximum of 15 tags per resource or resource group
- Tags can be enforced through Resource Policy
It is important to understand that tags can be applied to both resource groups and the underlying resources. However, if you apply the tag at the resource group level, it is not applied directly to the resources contained in the group. This can limit the usefulness of the tags. This is also an important example of how resource organization may be important. For example if you have a Cost Center tag applied to a Resource Group then all of the underlying resources should be associated with that Cost Center.
Tagging Usage: What are the benefits?
As organizations move more resources to the cloud, the Azure portal can start to get cluttered. Resources are inherently organized based on the Resource Type (ex. Storage Accounts, SQL Databases) as well as by Subscription and Resource Group containers, but this can be limiting. The tagging exercise can provide a dynamic, logical organization that provides a means to associate related resources across the resource type and resource boundaries.
Primary Uses for Tags:
- Leverage in your resource and cost management reporting
- Drive criteria (conditional logic) in automation scripts
- Drive navigation links between related resources
Cost Management Reporting
There are a lot of different options for Cost Management and Reporting systems available for Azure. All of the popular systems support the ability to leverage the resource tags within the reports allowing you to group or correlate the resources based on tags. In addition, the resource consumption export files will include the tag values giving you the ability to perform your own analysis on the raw data.
Example uses include:
- Supporting CostCenter charge backs: Determine costs for a particular application or resources associated with a department
- Segmenting environment costs: It becomes possible to break out costs based on Dev/Test/Stage/Production even within a single subscription
One of my current focus areas within Azure is enabling automation to help streamline the management of resources.
Example uses include:
- Start/Stop automation for Dev, Test, and other part-time workloads
- Resource life-cycle management
- Cost Management / over budget actions
- Azure Monitor and Alert actions
With proper tags applies, it will make it possible query to determine resources for a given application, environment, or applications nearing end of life so that appropriate actions can take place.
Logical Navigation of Resources
Last, but certainly not least, the tags will provide a logical navigation for users of the Azure portal making it easy to find and manage the associated resources.
The image below illustrates a listing of app services within a resource group. Initially, the list is unfiltered.
The list of resources can then be filtered by the tag, in this case the AppName:TimeTracking. This works great for filtering resource lists of a specific resource type.
Clicking into a resource, it will list its tags. Those tags provide the navigation links to other resources with that tag.
Clicking that link will lead to a listing of all resources with that tag as illustrated below. In addition, there is an option to pin that tag to your dashboard
From the dashboard, the tag link can make it easier for stakeholders and administrators to jump right to the relevant resources.
Define tags that align to reporting, management, and automation needs. If a tag is not needed to support one of those three things, it may not be needed.
Wrap-up and Helpful links
By leveraging tags on your Azure resources you can define logical associations between your resources to improve reporting, automation, and management of the environment. Implement a tagging strategy today!
In a future article I will cover some common challenges I have encountered, and the recommended approach for responding to those challenges to ensure that the tags can be managed throughout the resources’ life-cycle.
- Using Tags: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-using-tags
- Sample Policy – Enforce Tag Value: https://docs.microsoft.com/en-us/azure/governance/policy/samples/enforce-tag-value