Deallocating virtual machines (VMs) is essential to efficiently saving costs and resources. This article will discuss multiple approaches to achieving this task.
Table of Contents
Deallocate A VM In Azure
Let us dive deep into the three simple approaches to doing this.
Approach-1: Using Azure Portal
Follow the below steps
1. Log in to the Azure Portal.
2. Search for Virtual Machines and click on the search result Virtual machine as shown below.

3. Click on the specific VM from the lists you wish to deallocate.

4. On the Overview tab, click the Stop button to deallocate the Azure VM.

5. Now, click the Yes button on the next pop-up for the confirmation.

6. Now, the VM was stopped (deallocated) successfully. Check out the screenshot below for your reference.

Check out How to increase disk size in Azure VM
Approach-2: Using PowerShell
You can execute the Azure PowerShell command below to deallocate the Azure VM.
Stop-AzVM -ResourceGroupName "newresgroup" -Name "AzureLessonsVM" Click on the Yes button to confirm.

You can see the query has been executed successfully.

Now, you can check out that the Azure VM was deallocated successfully. Check out the screenshot below.

Check out How to add public IP to Azure VM
Approach-3: Using Azure CLI
You can execute the Azure CLI command below to deallocate your Azure Virtual Machine.
az vm deallocate -g newresgroup --name AzureLessonsVMThe above command was executed successfully. Check out the screenshot below.

Now, you can able to see the VM was deallocated successfully. Check out the screenshot below.

FAQs
How long does it take to deallocate a VM in Azure
Answer: Max 90 minutes.
Conclusion
If you wish to save cost-effectively, you can deallocate a VM in Azure while not using it. To achieve this, you can use Azure Portal, PowerShell, and Azure CLI.
You may also like following the articles below

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
