Azure Virtual Machines – Stopping versus Stopping (Deallocating)

 

In the Small and Medium size business environment you often hear of the concept of saving consumption expenses by stopping virtual machines not in use.  While this is not a concept I fully agree with being an old enterprise IT person; it certainly has it virtues in situations such as non-production or seasonal computing.  It is important to make sure you understand the difference in stopping versus stopping (deallocating) before you decide to “flip the switch”. Let me point you to the following pulled from the MSDN documentation entitled About Starting, Stopping  and Restarting an Azure VM to provide some simple guidelines on this topic.

Stopping (deallocating)

When does it occur?    You or Azure shuts down the VM by using Azure tools or processes. In most cases because you or a subscription co-administrator controls when this happens.

  • If you do not need to use the VM immediately and want to minimize costs, but want to be able to resume work with it later, you can shut down the VM – for example, by selecting the VM in the Management Portal and clicking Shut down.
  • If you configured the VM in an availability set configured for autoscaling, Azure could shut it down in a scale-down action.
  • In specific situations, if Azure detects that the VM is not available or healthy because of problem like faulty hardware, Azure shuts down the VM and migrates it to different hardware.

What happens?    By stopping (deallocating) a VM, you not only stop the VM’s OS, you also free up the hardware and network resources Azure previously provisioned for it (a process called deallocation).

IMPORTANT:  Unless you configured static addresses, you also release the internal DIP address, as well as the public VIP address (if no other VMs are using the public VIP, as the VIP is assigned to the cloud service and not directly to the virtual machine). When you restart the VM, it will then pick up a new public VIP (if it is not joining a cloud service that already has one) as well as a new DIP.

The VM’s OS and data disks remain intact in Azure storage and can be used to restart the VM later. However, the temporary (scratch) disk associated with the VM is released and any data on that disk could be lost.

How do I know it happened?    If the VM doesn’t restart immediately as part of another operation. Azure shows a VM status of Stopped (Deallocated) in the Azure Management Portal or other Azure management tools.

Is the VM charged?    Azure doesn’t charge for the VM core hours while it is Stopped (Deallocated). You continue to accrue charges for the Azure storage needed for the VM’s OS disk and any attached data disks.

Are services available on the VM?    While the VM is Stopped (Deallocated), you can’t connect to it remotely, and service endpoints on the VM don’t accept network traffic. Unless you group the VM in an availability set with VMs performing similar work or configure load-balanced endpoints, the workload that the VM runs will be unavailable.

Additional things to know

  • While the VM is Stopped (Deallocated) you can still change certain VM settings. For example, you can resize the VM and add data disks to it.

Stopping

When does it occur?    You or a process running on the OS in the VM shuts down the OS. In most cases you or a subscription co-administrator controls when this happens.

  • As part of managing the VM, you might need to manually shut down the OS temporarily – for example, to reconfigure an application running on the VM. You may also want to run other tools that shut down the OS – for example, Sysprep on a Windows VM.
  • An application or OS problem could shut down the OS unexpectedly.
  • Azure periodically stops each VM for a short time to perform routine, planned maintenance in an Azure data center, before restarting the VM.

What happens?    The OS in the VM is stopped and the VM services are unavailable, but the VM continues to reserve the compute and network resources that Azure provisioned.

How do I know it happened?    If the VM doesn’t restart immediately as part of another operation ), Azure shows a VM status of Stopped in the Azure Management Portal or other Azure management tools.

Charges   Azure continues to charge for the VM core hours while it is Stopped (but not Stopped (Deallocated), based on the size of the VM and the image you selected to create it. You continue to accrue charges for the VM’s cloud service and the storage needed for the VM’s OS disk and any attached data disks. Temporary (scratch) disk storage on the VM is free.

Are services available on the VM?    While the VM is Stopped, you can’t connect to it remotely, and service endpoints on the VM don’t accept network traffic. Unless you group the VM in an availability set with VMs performing similar work or configure load-balanced endpoints, the workload that the VM runs will be unavailable.

Additional things to know

  • While the VM is Stopped, you can still change certain VM settings. For example, you can resize the VM and add data disks to it.
  • If you run Sysprep with the Shutdown option on a Windows VM (required if you want to capture the Windows VM), the VM status is then Stopped. You can’t shut down the VM with Sysprep so that it is Stopped (Deallocated).

I hope this help to clarify the difference between the two Virtual Machine states.

Kathleen Molosky 2013

Kathleen Molosky