If you are like me, you like to fiddle a bit. In the case of Azure, that’s great but we have to remember to clear up after ourselves. I like to start my day in Azure Advisor to see if an Azure resource has a recommendation to improve it’s security or availability, but what about services that are idle? Besides, it is always a little concerning when the Azure portal asks you to type out the resource group name before it is deleted. It feels permanent. That’s because it is, let’s see how we can go about this task.
One of the concerns some people may have is how do I safely delete an Azure resource? How do I know it is or is not in use? Here are some tips that I have to help you navigate to safe deletion.
Check the Overview
The most effective place to look is the Overview, it will show you what resources are assigned to this resource group, and in this case – there is nothing. This means no storage, no VMs, etc. are managed by this resource group:
Check Activity Log
This is my go-to first step, and you are initially shown results from the last 6 hours. This resource group is conspicuously named “Group”, which is completely non-descriptive. This is shown in the figure below:
This poorly-named resource group seems like I was testing something quickly and didn’t clean up after myself. You can also show activities from up to 3 months in the past, which particular resource has nothing going on. Here is the filter for custom dates:
The Activity Log is a good first look to see if there is any activity in this resource.
Run PowerShell for some Information
I’ll admit, I’m not a PowerShell expert, but Azure’s PowerShell implementation can give you a lot of good additional information on resource groups to help you find out some more information. If I run the Get-AzureRMLog cmdlet it will tell me what is active for this resource group. This is the syntax I’ve run below:
Get-AzureRmLog -ResourceGroupName "Group"
The poorly named resource group called “Group” returns no information when I execute this command, confirming no activity:
By way of comparison, I have a much more active resource group; and the same command run over there will show much more information.
Check when this Resource Group was created
Possibly the most helpful final piece of information is to see when a resource group had services deployed along with it. When I click on this example one called “Group”, I can see it was created in October 2014.
This was to deploy some VMs that were subsequently deleted. When you click on the deployment name, you’ll see what resources were deployed when this resource group was formed. This is shown below:
Then I can click on each of the individual resources to see their history, and depending on the type of resource you can get a different message indicating they are or are no longer in your subscription. I clicked on a VM that was part of this resource group and this cute and funny message gives me the bad news that this VM is no longer in my subscription:
This is because I likely deleted the compute, networking and storage services associated with whatever I was testing in October of 2014; but I should have cleaned up the resource group as well.
The final check!
When you go to delete, Azure will tell you what resources are impacted by deleting a resource group. If you have checked all of the steps above; it should be a clear panel here like what is shown below:
Many things to check, but good idea before deleting One tip also is to use tags (see my previous post) to organize and categorize Azure resources. But housecleaning tips like this can make sure you have the confidence you need before you delete a