How To Deallocate A VM In Azure

Deallocating virtual machines (VMs) is essential to efficiently saving costs and resources. This article will discuss multiple approaches to achieving this task.

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.

Stop and deallocate azure vm

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

how to stop and deallocate azure vm

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

how to deallocate vm in azure portal

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

how to deallocate vm azure

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

how to deallocate azure vm

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.

deallocate azure vm powershell

You can see the query has been executed successfully.

how to deallocate azure vm powershell

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

how to deallocate an Azure VM using PowerShell

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 AzureLessonsVM

The above command was executed successfully. Check out the screenshot below.

deallocate vm in azure

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

how to deallocate a vm in azure

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

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!