Shutdown Microsoft Azure Linux VM

Stopped vs Stopped — Deallocated

stopped vs stopped Deallocated

There are two options for “shutting down” a virtual machine (VM) running in Microsoft Azure. Each of the two methods has different impacts on the cost of your Azure subscription.

One is that you are charged for computing resources, and the other is that you are freed from the costs of computing resources and can reduce your overall costs. In this article, we’ll look at these and explain the differences between them.

Option 1

The first way to shut down an Azure VM is to shut down the operating system, which sounds logical when you connect to Remote Desktop. In this scenario, connect to Remote Desktop, and when you’re done, go to the Windows operating system power options and select the Shutdown option. This basically “turns off” or shuts down the virtual machine (VM) and stops running. However, this method pays for Azure VM computing resources (also known as hardware allocation) in the data center, even if the VM is not running. As a result, the Azure portal reports the status of the VM as “stopped”.

Option 2

The second way is to go to the Azure portal (or use the Azure CLI or even Azure PowerShell) to stop the VM. Azure not only shuts down the operating system but also frees the computing resources allocated to the VM. This frees up the computing resources of another customer in Microsoft Azure. As a result, Azure no longer charges for compute resources and Azure reports the status of the VM as “stopped (allocated)”.

By freeing resources using Azure, it’s a good idea to stop the VM if you don’t really need to run it. In the stopped (Desallocated) state, you are not paying for the VM resource. This really helps you save money!

  1. Using Azure CLI to stop the Azure VM.

While using the Azure portal is good, there are times when you want to automate the suspension and allocation of Azure VMs. This can be done through the Azure CLI using the following command:

# Stoping Azure VM
az vm stop --name {vmname} --g {resource group name}
# Deallocating Azure VM
az vm deallocate --name {vmname} -g {resource group name}

2. Shutting down VM using Azure Portal


There is one thing to be aware of when shutting down an Azure VM.

It gets placed into the Stopped (Deallocated) status. this causes Azure to release the server resources associated with the Virtual Machine, it not only releases the CPU and Memory resources but also the Dynamic IP Address allocation. Due to this, when you start the VM back up again, the IP Address will likely change. If you require the IP Address to never change for your VM, then you`ll need to configure a Static IP Address for the VM.

Note that the storage account contains the VM’s .vhd disk image file. When the VM is closed, all VM settings / configurations and VHD images stored in Azure Storage are preserved. In the meantime, there are storage costs, but at least you can save VM resources. After all, storage is cheaper than allocating resources to a virtual machine if you keep it running.



Computer Engineering Student, i’ve got a big passion in Computer Technology, programming and in solving problems. Https:// 💖

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahed Bahri

Computer Engineering Student, i’ve got a big passion in Computer Technology, programming and in solving problems. Https:// 💖