<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=2012313439098820&amp;ev=PageView&amp;noscript=1">
Posted by Dana Epp

5 Tricks to Using Azure Tags Effectively

Learn how to optimize the organization and management of your Azure resources using Tags. In our most recent episode of #KnowOps, we shows 5 of our favorite tricks to keep on top of stuff using Azure tags.

Video Transcript

When you first start managing resources in Azure, it's not that difficult. But as you start adding more and more resources across different test and production environments, it can get really complicated fast. In this video, I'll show you five tricks you can use to get a handle on this using Azure tags.

Dana Epp here. Welcome to the channel that helps aspiring Azure administrators like you and me to know opps and, well, master the Microsoft cloud. I'm glad you're here. If you haven't yet, smash the subscribe button so you can be notified when I release new videos each week.

Azure tags are a great way to maintain governance of your cloud resources and control and track things. Tags make it easy to categorize, organize and search resources quickly. They're basically labels, metadata attached to resources as key-value pairs. The tags stay with the resource, so even if you move them between resource groups, they stay with it, and they aren't inherited. Which means if you assign tags to a resource group, they're not applied to the resources themselves. It's important that you understand the tricks and traps of tags like this.

So let's look at five tricks with tags that you can use to make your life easier when managing resources in Azure. Create an Environment tag, then assign resources with values like DEV, QA and PROD, or whatever you call your different environments. This creates logical groupings of resources so that if you ever have to share environments in the same subscription, you can quickly organize and track things. It also lets you take advantage of automation runbooks.

Once you start using environment tags, you can leverage them to shut down nonessential resources in off hours through automation runbooks. As an example, you could set up a runbook to automatically turn off all VMs running in the Dev environment in the evenings and on weekends. This could really help reduce your cloud compute costs.

Speaking of costs, let's discuss cost tracking. Create a CostCenter tag. You can use this to allocate resources to the teams or departments that are ultimately responsible for their costs. Then in Azure Cost Management, you can apply the CostCenter tag as a filter to report the charges based on a team or department's usage. Trust me, your FinOps guys are gonna love you for this. If you're gonna leverage tags properly, it's important that essential tags like Environment and CostCenter are applied on all resources as they're created and changed.

To maintain the data hygiene for tags that you always wanna see on a resource, use Azure Policy. Microsoft has published built in policy definitions to help you enforce required tags and their values. This way, new resources can't even be created without properly setting these tags first. And under Compliance, you can see the existing resources that don't have these tags yet.

Quick tip when using compliance policies. You need to be patient.

Once you apply a policy for tags, it can take up to 30 minutes before you'll actually see them properly reported in the compliance blade of Azure policy. So go grab a coffee and wait. It'll start showing up by the time you get back. This is one of the few times where I think Microsoft has made the Azure portal user experience much nicer than the CLI, especially when working with tags.

When you've got to set a tag, if you aren't careful you can destroy what was previously set when using the CLI. In other words, when setting a tag through the command line, it will overwrite all previous tags. They aren't appended. So before you set a tag, make sure you read all the previous tags from the resource into a variable. Then append your new tag to that variable before setting it back out. Trust me, I've had a few occasions where this bit me in the butt.

Thankfully, though, Azure Policy was there to notify me that I put a resource out of compliance. Or just use the tags Blade to Portal. Just as good, and you don't have to worry about screwing things up.

So there you have it. Five tricks to using Azure tags more effectively.

  1. Use an Environment tag to track deployments.
  2. Use tags in automation runbooks.
  3. Use a CostCenter tag to track costs.
  4. Use Azure Policy to enforce tag usage.
  5. Don't clobber your tags in the Azure CLI.

I hope you found this useful. Let me know by hitting the like button, and if you haven't yet, smash the subscribe button so you can be notified as I publish more videos. Until then, thanks for watching. We'll see you in the next episode.


Azure Tags make it easy to categorize, organize and search resources quickly. They're basically labels #knowops @auditwolf




Topics: Cloud Operations (CloudOps), KnowOps