Azure: Deleting Unused Services — Reducing Unnecessary Bills

Amir Mustafa
5 min readJun 25, 2023

--

→ Team, you might have worked in various Azure services in your organization or personally or even aspire to start using Azure services.

→ Today, we will learn a refactoring technique that I believe everyone should adopt or most of you are already doing.

→ At the time of the creation of any Azure service, it asks to create a Resource Group, and all services used for that project will be linked to that Resource Group (RG)

→ The idea is after work is completed or if we were working in Sandbox or DEV environment and moved to the UAT environment, and now need not require it, we should delete it.

→ At the end of the month or your subscription plan, every service generates some bills that are to be paid by your organization or if personal by you.

Why it is necessary?

→ Why should we pay for something, we are not consuming?

→ In Azure or AWS or GCP or other cloud technology, we have to explicitly delete the unused service, otherwise we will be charged on a monthly basis even if we do not use it.

What are we trying to achieve here?

→ Delete unnecessary/unused/inactive Resource Group, it will delete all apps or services inside it.

→ This will save cost in Azure Bill.

Azure Demo:

→ We were using Azure ML Service recently. Let us delete all the apps or services.

→ Open the Azure portal. We see recently used services on the homepage.

→ Click ml-happylearnings786

→ We see the resource group of this service here — whatever we used for this service will be linked to it. Click this resource group i.e. machine-learning-rg

→ We can see all linked apps. We can delete this app one by one.

→ Instead what we will do is delete this resource group itself, all apps inside it will be deleted.

→ It saves time as well.

→ Click the Delete resource group button, shown in the above screenshot.

→ A popup opens. Copy-paste the resource group name below. i.e. machine-learning-rg, followed by clicking the Delete button.

→ Let us go to the Azure portal homepage, because this will be deleted in some minutes.

Alternate Place to Delete/View Resource Group

→ Click Resource Groups from the Azure homepage.

NOTE:
Here we will see all the resource groups associated with your account.
Do not delete unknown resource group that might be active.

→ For our case it was machine-learning-rg.

→ We also see all environments associated with this service. In IT company projects we always see environments such as Sandbox, DEV, UAT, FUT, or Production, etc.

Q. Think why are we deleting this environment?

→ In our case we have worked in a machine-learning-rg environment and we have moved to DEV or UAT environment (for example 😀). As it will create unnecessary Azure bills.

→ We observe that machine-learning-rg is now deleted (took 3 to 4 mins) and all apps associated with it are also gone.

→ We also observe ml-happylearnings786 service that was inside machine-learning-rg is also deleted.

Same Feature in other Clouds

Azure Resource Group is a logical container that allows you to manage and organize related resources for your applications or projects.

If you are working in AWS Cloud, its equivalent is AWS CloudFormation Stack or an AWS Cloud Development Kit (CDK) Stack.

AWS CloudFormation is a service that allows you to define and provision AWS infrastructure as code. A CloudFormation Stack is a collection of AWS resources that are created, updated, and deleted together as a single unit. It provides a way to manage and organize related resources.

If you are working in Google Cloud Platform (GCP) Cloud, it’s equivalent is AWS CloudFormation Stack or an AWS Cloud Development Kit (CDK) Stack.

GCP Deployment Manager is a service that allows you to define and manage GCP infrastructure as code. A GCP Deployment is a collection of GCP resources that are created, updated, and deleted together as a single unit. It provides a way to manage and organize related resources in GCP.

Video:

Closing Thoughts

In this article, we have learned how we can delete Azure services that were created and for some reason not deleted that were generating bills.

Simply have gone to a service, located its Resource group, and deleted it.

Thank you for reading till the end 🙌 . If you enjoyed this article or learned something new, support me by clicking the share button below to reach more people and/or give me a follow on Twitter and subscribe Happy Learnings !! to see some other tips, articles, and things I learn about and share there.

--

--

Amir Mustafa
Amir Mustafa

Written by Amir Mustafa

JavaScript Specialist | Consultant | YouTuber 🎬. | AWS ☁️ | Docker 🐳 | Digital Nomad | Human. Connect with me on https://www.linkedin.com/in/amirmustafa1/

No responses yet