You should always build an Azure based VM in a Resource Group

SQL Masters Consulting practice what we preach..

Views 523

When SQL Masters Consulting conducts training – for example our popular DevOPs for the Database series and High Availability and Disaster Recovery session – we utilise Virtual Machines based in Azure.
This allows us to spin up resources as required and Warwick has written a great blog post here about how we do that:

Which reminded me of a situation I observed where a couple of MVPs were having a discussion around how to commission and de-commission VMs based in Azure.

It came down to this simple fact – you might still pay for resource usage in Azure even after you have deleted your VM….


Because if you just delete your VM – you will leave behind resources that were associated with it.

Note: At SQL Masters Consulting we host all individual VMs in their own Resource Group – thus what I’m about to preach – we practice.

We’re not that big to just squander money!!

The VM I want to spin up is for a DEMO I am going to do at a client site – we’re going to build SQL Server using Desired State Configuration (DSC) – in fact we’re going to build 20 SQL Server instances – and then create 10 Availability Groups – all from Source Control and all scripted. That is definitely for another blog post.

Let’s look at how we spin up the VM:


I’m not going to go into all the different configurations you might want to choose – this post is about what is left behind when you delete the VM and why you’ll pay money unnecessarily.

I had witnessed people storing all their VMs in one Resource Group – to be tidy and concise…

So we deploy our VM and under 4 minutes later we have our VM:

Let’s look at the resources in our Resource group:

<time passes>

So I’ve done the DEMO of SQL Server DSC (blog post coming) and now we want to get rid of the VM.

This is what some people do – they manage the VM from a VM perspective.

To highlight this – go into Virtual Machines and hit Delete

So within about 5 minutes the VM is gone – so let’s look in the Resource Group:

This highlights that  if you manage your VM from a VM perspective and not all the resources associated with it – you will get charged for things lying around.

It’s not a completely free cloud platform after all.

However if you want to remove your VM in its entirety then place it in a Resource Group and remove the Resource Group.

Thus you remove all resources associated with that VM and do not get charged unnecessarily.

There might be times where you want to host associated things within a resource group 0 my advice – label them and put tags on them so that you know what belongs to what if you need to remove things.

Which is why we manage all our VM resources within their respective Resource groups – it makes housekeeping much easier – especially when we are spinning up and tearing down 10-20 VMs a week for training and DEMO purposes.



Hi, I'm Hamish Watson, I am a Microsoft Data Platform MVP and Database DevOPs evangelist for SQL Masters Consulting. In my blog posts I will look at all things Database DevOPs to assist your professional development.


Your Cart