attachments/kdavis/media/virtualmachinemenu.png

Azure Virtual Machines Dev/Test Billing

Overview

As of June 2013 Microsoft made a competitive and attractive move by not charging owners of a subscription for VMs that are in a stopped state. This is a huge step forward and really puts organizations in a difficult position when trying to find that staying with an on-premises implementation of their Dev/Test environment is in any way a cost-savings over the move to Azure. There is still a charge for the storage of the VHDs that belong to a Virtual Machine (VM), but this cost is minimal at best when compared to the hourly or monthly cost of larger VM sizes when not be accessed or needed at the moment.
There is some prerequisite knowledge that subscription owners should have before jumping into their subscriptions through the Azure management portal and starting to turn off VMs and turning them back on at random, hoping to save some money and at the same time expecting everything to work as well as it did prior to turning off the VMs.
 

A bit of Education

Looking at this from strictly a cost-savings perspective, you need to know that the VM needs to be in the "Stopped (Deallocated)" state for you to avoid compute hour charges. This state cannot be arrived at by simply clicking on "Shutdown" from within the OS. You must either use the management portal and choose the Shutdown option, seen below, when you have a VM highlighted or use PowerShell and execute the Stop-AzureVM cmdlet and ensure that the -StayProvisioned switch is not used.
 VirtualMachineMenu.png

If you choose to use the management portal you will actually get a warning, shown below, that if you continue that the IP address lease for the VM will be released.
 
 StoppingVMthroughMgmtConsole.png

This isn’t a good situation if you have something complex like SharePoint deployed within Azure, because you run the risk of each of the servers receiving a different IP address from what they originally had when the SharePoint Farm was implemented. The reason for this lease release is because in order for a VM to maintain its lease on an IP address it must be in either a "Running" or a "Stopped" state, it cannot be in the "Stopped (Deallocated)" So, you may ask, is saving money even possible when you have the need to maintain IP address for VMs in your subscription. The answer is yes, but it requires you to put a bit more thought into how you go about it. I would reccommend that you continue to run all VMs that are a dependency for other VMs e.g. (DC/DNS, SQL, etc.). VMs that are not in this category are great candidates for stopping over the weekend or the evenings when they would typically not be used e.g.(SharePoint single server farm, Isolated App/DB server).
 
 
 

Conculsion

Using this newly acquired knowledge you can extend this example to leverage a scheduling solution to schedule the starting and stopping of VMs using PowerShell to ensure that you can maximize on the cost saving benefit that Microsoft is offering you in environments that support this approach like Development and Test environments.

Leave a Reply