This post contains 10 tips and tricks you can use to save money on your Virtual Machines (VMs) running in the Microsoft Azure cloud. The cost analysis of the cloud can be scary at first, and it’s actually one of the reasons companies are shy to start adopting the cloud. Once you know these tricks you’ll feel confident that you won’t overspend and go broke in Microsoft Azure.

Some of these tips are almost secrets, as they aren’t really talked about anywhere. I know these from my years of experience working with Microsoft Azure and getting to know many of the ins and outs of the platform. So, read below, and benefit from my years of Azure experience in just a few minutes.

Using these tips will certainly help you save your company or organization money, and will likely impress your boss!

1) Research Azure Region Pricing

There’s a little known secret to the pricing of Virtual Machines in Microsoft Azure. The secret is…

Not all Azure Regions will have the same pricing for the same resources. This includes Virtual Machine pricing tiers as well. Yes, you are understanding this correctly! The cost of Azure actually varies from Azure Region to Region!

While you generally should provision your Virtual Machines and other resources within the closest Azure Region to your customer and users, you may find there to be a pricing benefit of choosing one Azure Region over another.

The above screenshot was taken at the time of writing this. As you can see for the three VM instance sizes shown the prices are different between the South Central US and West US 2 Azure Regions.

This pricing difference is not something you’ll see in the Azure documentation. Nor will you find any guidance anywhere telling you which Azure region is cheapest. You’ll need to use a combination of the prices listed within the Azure Portal when provisioning a VM, as well as the Azure Pricing information to make your own comparisons when determining which VM instance size and Azure Region to choose.

2) Deallocate VMs when not in use

There are many Virtual Machine workloads that are only needed a certain amount of time. These VMs may be used to run a monthly process or are only used to connect to with Remote Desktop during business hours. There could also be other reasons your VMs might only be used a fraction of the time that’s FAR less than 24 hours a day / 7 days a week.

By Deallocating (or stopping) your VM when they’re not in use, you can save hosting costs pretty amazingly. The reason this works is that the CPU, Memory and other hardware reserved for the VM is released. This allows Azure to let someone else’s VM use that hardware, so you are no longer on the hook to pay for it. Then when you need to use the VM again, you can simple start it back up again and get to work.

There are 2 ways to manage Deallocating VMs when they aren’t in use:

Manually Stop (Deallocate)

The first option is to go into the Azure Portal, navigate to the Virtual Machine blade for the VM in question and then click the “Stop” button. This will essentially work to turn off your VM, and it will deallocate the resources for the VM as well.

Virtual Machines can also be Stopped this way to deallocate resources through the use of the Azure CLI (Cross-Platform Command-line) or the Azure PowerShell cmdlets.

Configure Auto-shutdown

The second option is to configure the Auto-shutdown feature of the Virtual Machine you wish to Stop and Deallocate. With VM Auto-shutdown you’re able to configure a specific Time (including Time Zone) when Azure is to automatically shutdown the VM and deallocate it’s resources.

This option can be particularly useful when there’s a chance that you or someone else might forget to Stop and Deallocate the VM manually.

3) Resize Overprovisioned VMs

Accurately determining the appropriate VM instance size can be tricky. This can be especially true when provisioning new VMs for use with a completely new production workload. It can also be tricky to get the instance size set ideally when migrating an on-premises workload into Azure. For these reasons it can be extremely common to accidentally over provision a VM to use a larger instance size that it really needs.

Once you can determine that there’s too much CPU / Memory resources allocated to your VMs, you can manually resize the VM instance size. This allows you to change the instance size used to host your Virtual Machine manually at any time.

Keep in mind that resizing the VM will require the VM to be rebooted. This is not something you want to do to a VM under peak load.

4) Dynamic Scaling with VM Scale Sets

Beyond manually scaling (or resizing) the VM instance size, you can actually have this down for you automatically if you create your VMs within a VM Scale Set. This allows multiple identically configured Virtual Machines to be setup to run a certain workload in such a way that Azure can dynamically add or remove server instances to meet demand.

5) Use Azure Marketplace VM Images

The Azure Marketplace contains thousands of images for various configurations and operating systems from both Microsoft as well as third party vendors. There’s a really good chance that the VM image you need to deploy can be found in the marketplace.

By using VM images from the Azure Marketplace, you are able to choose from many images that include the licensing to the OS (Operating System). For example, all VM images for Windows Server in the Azure Marketplace include the licensing for Windows Server without any extra licensing cost.

On the other hand, if you were to create your own VM locally with Hyper-V or VMWare, and then upload it into Azure, you would need to provide all the licenses necessary to run that Virtual Machine. This could cause you to be required to have or pay for additional licensing that the Azure Marketplace would be able to save you from.

For example, if you’re provisioning dozens (or more) Virtual Machines in Azure that run Windows Server, then you would save a significant amount of money by using one of the Azure Marketplace images to start from. Once you provision the marketplace image, you can then remote into the server and install any necessary software and perform any required configurations for your workload.

6) Use Azure Storage for SMB File Shares

There are many times when you might be required to have an SMB File Share. Generally you would spin up a Virtual Machine with plenty of storage capacity to use. While you could do this in Azure, it’s actually more cost effective to make use of the Azure Storage PaaS (Platform as a Service) features for creating an Azure File Share instead.

With Azure Storage File Shares, you don’t need to maintain any Virtual Machines. This mean you don’t have to worry about any Operating System patches or software updates. The Storage service is completely managed for you by Microsoft since it is a PaaS offering.

Also, an added benefit you get from Azure Storage File Shares, over an on-premises setup, is that you automatically get data redundancy (in triplicate) as a built-in feature of the Azure Storage service. As compared to On-premises where you would need to setup and manage a hardware RAID or use Windows Storage Spaces to implement a similar data redundancy setup.

7) Migrate Apps to Azure App Service

The most common method of migrating existing workloads to Microsoft Azure is to run then in Azure Virtual Machines. While this will work to get things going, it may not be the best option. “Lift and Shift” may help you migrate into and adopt the cloud, but depending on your workload it may not be the best or cheapest option to choose.

One of the most common mistakes with “Lift and Shift” migration into Azure is to over provision the VM instance size. This is one of the more commonly known issues to deal with, however, the consideration of Platform as a Service (PaaS) instead is an extremely viable option that many applications and workloads can benefit from.

Azure App Service is the service that allows you to host Web Apps, Background Processes, API Apps, and Mobile App back-ends using a PaaS service. As a Platform service it enables you to manage your application, it’s data, and settings without worrying about the underlying VM. Azure App Service is built on fully managed VM so there’s no Operating System, patch, or other platform updates for you to worry about. This can really decrease the overall maintenance costs of your applications and workloads by eliminating the work required by your Infrastructure / Admin team.

When hosting applications in Azure App Service, you create a new Azure Web App, API App, or Mobile App, that is the service you deploy your application too. You also create an App Service Plan that is where you define the pricing tier; including CPU Cores, Memory, and other resources. Then you can host 1 or more Azure Web Apps, API Apps, and Mobile Apps within the same App Service Plan, thus allowing you to share underlying VM resource across multiple applications. You can also migrate Azure Web Apps, API Apps, and Mobile Apps between App Service Plans if necessary as you need to scale to handle changes in load.

8) Delete Unnecessary Resources

Unused resources like VMs, Storage Accounts, Web Apps, and on, and on will keep costing you money in some fashion if you keep them around. If you’ll need them in the future then it may be necessary. However, if you will never need them again, then you should probably remove or delete those resources from your Azure Subscription.

Removing or Deleting resources in an Azure Subscription can easily be performed within the Azure Portal, or using the scripting tools like the Azure PowerShell cmdlets and Azure CLI (Cross-Platform Command-line interface).

9) Use Azure DevTest Labs

Manually stopping and deallocating Virtual Machines can really save you money in Azure. Although you do need to remember to actually stop the VMs. For this reason Microsoft Azure includes the DevTest Labs service. This service allows you to setup VMs for Development and Testing purposes that will automate the shutdown and startup of your VMs for you. You can even minimize waste by using quotas and policies as well.

10) Audit your Azure Usage

It can be easy to leave unused resources sitting there and possibly even forget they are there. As a result, it can be important for your budget to take some time every so often to audit your Azure usage.

When navigating to view your Azure Subscription in the Azure Portal, you can view your spending by resource. You can even see a Burn rate on your Subscription to keep track of where your spending it as during the current billing period.

In addition to view the your Invoices and other things, you can also see a Cost Analysis that will allow you to drill deeper into your Azure spending. This will allow you to see how much you’re spending on various resources in your Azure Subscription.

It is important to periodically audit your own spending to ensure you don’t break your budget, and keeps you from spending money unnecessarily. As a single user it may not make too big of a difference if you’re really good at shutting things down and deleting unused resources, however, a bigger team or organization can accidentally spend some serious money really easily.

Don’t forget to audit your Azure usage every so often.

2 thoughts on “Top 10 Tricks to Save Money with Azure Virtual Machines

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s