Azure: Working with Resource Groups

What is a Resource Group?

Azure is a behemoth, collecting a massive amount of different products and services under a single umbrella. This allows you to do some incredible things, but at the same time can become incredibly confusing to maintain when you start going beyond the basics.

A Resource Group is Azure’s way of helping you make sense of everything you have created by grouping your resources together in a single easily accessible way. By associating your resources with a resource group, you can see all related resources together in a single view, apply permissions to the group for easier security and ultimately apply actions like delete on all things below it at the same time.

Creating a Resource Group

For Azure, go to the portal and sign in to your account. Client on Resource Groups in the left hand column.

From here you can see all the Resource Groups you currently have or create New ones. Click ‘Add’ in the top left of the blade you just opened.

This page is deceptively simply but actually really important. You select the subscription that will be paying for the account then give it a name. Something meaningful so that later you easily know what the things below this relate to. Commonly I will call them product names or Web App names like ‘company_hr_website’. This will then group the sql servers, storage accounts, app services etc that are required to run that site.

The important bit here though is the Region. Usually this is pretty simple, pick the one that geographically makes sense to your users as this will result in the lowest latency. However, some Azure products are not available in all Regions yet and this can’t be changed afterwards. If you’re thinking of using a resource that Azure have only just released, it probably wont be available in all Regions, so double check first whether this will cause you headaches later.

You are supposed to be able to have multiple regions within a resource group as the resource group metadata is separate to the resource itself, but i have encountered head aches with this, so be warned.

You can add tags to all resources in Azure, so I won’t go through them here but tag as appropriate to make it easy to report on them later.

Finally, assuming Azure passed the inputs and validated the details, click ‘Create’. This creates you an empty resource group that you can now associate your services with.

Deleting a Resource Group

Deleting a Resource Group is deceptively simple, so be careful.

Whilst Resource Groups are fantastic for keeping an eye on related resources, they also make it very convenient to tidy up unneeded services as well.

Going into the portal and selecting ‘Resource Groups’ from the left hand menu brings up the list view including the resource group we created earlier. Clicking name will take you to a list view of all the resources in that group, but what we want to do is click the three dots on the right hand side. This opens up a small menu with the option to ‘Delete Resource Group’. Click it.

This options a blade that gives you a strict warning. Deleting a resource group deletes all resources it is associated with. This makes it a convenient tool to work on demos with. You can create a resource group, set up your products and then delete everything in one fell swoop.

You’ll be asked to review the Resource Group, including a list of all resources so double check that you haven’t accidentally associated something with the group you didn’t mean too, then enter the name of the resource group into the input field.

Setting a Budget

Although creating Resource Groups to work through Demos with and then deleting them afterwards is great, realistically you are going to want to keep a fair few of these around in the real world for actual apps or sites you’re running. In these instances there are a few things you are going to care about – monitoring, performance and expense. Whilst there are some cool things you can do for monitoring and performance on Resource Groups, the quickest is to keep an eye on how much it’s gonna cost you.

From the list of Resource Groups as shown above, click on the name to take you to the Resource Group details. From here, you can scroll to nearly the bottom of the blades left hand menu and select ‘Budgets’.

Budgets are a great and simple to use feature to allow you to set up an alert based on current expenditure of your account. It’s not predicative i.e.won’t alert if you’re expected to exceed a quota for the month, but it can be an easy way to be alerted if your resource eats through your monetary allowance quicker than expected.

Click ‘Add’ at the top of the list view.

To create a budget is nice and straight forward.

  • Give the budget a name
  • Set the budget amount and the interval (monthly)
  • You can set the expiry date if you want to stop monitoring later
  • Create an Alert condition, stating a % of your budget
  • Within this you could set an Action If you have this, but we wont cover this here
  • Then set who you want alerted if this condition is met

That’s it. Set it to something like 75% of your budget and fingers crossed you will get it 3/4 of the way through the month. Couple this with Auto scaling, performance and monitoring and you have a nice easy way to keep track of your resources.

Summary

Resource groups are a great way to keep track of your resources in Azure allowing you to monitor them, their use, cost and easily delete them later if you need to. They’re required these days, so no excuses not to use them!

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s