Denys Rudyi - Fotolia

Manage Learn to apply best practices and optimize your operations.

How to bring Azure costs down to earth

Don't let Azure VMs rack up a huge monthly bill from Microsoft. Figure out your business needs, then adjust the options in Azure to minimize charges.

The migration of virtual machines to the cloud sounds great -- until your IT department is hit with a huge bill.

For every minute the VM runs and byte it uses, Microsoft adds charges to a monthly tab. How do you manage Azure costs? The formula is relatively simple -- admins should understand the approximate price tag before workloads move to Azure and right-size VMs to reduce wasteful expenses.

Find the right Azure region

The first step is to select the proper Azure region. Each region has different resources, capabilities and services; these facets -- and its relative location compared to the business -- produce the cost per region. Not every region is available -- it depends on the organization's location or subscription. For example, users in the United States cannot use Australian data centers without an Australian billing address.

A move to a less expensive Azure region makes a noticeable difference when it involves several dozen servers. However, a migration to a different Azure region affects the end-user experience with increased latency if applications move further from users and customers. Admins use Microsoft's Azure latency test site to understand network performance per region.

Don't make one-size-fits-all VMs

To further reduce Azure costs, align VMs to the proper performance level. For example, differentiate between production and dev/test environments, and build VMs accordingly. Dev/test VMs don't usually need the production specifications as they rarely require high availability. Reduce the resources -- and their associated costs -- for dev/test VMs so they get only what they need.

Look at infrastructure as a service (IaaS) servers

In the web-based GUI wizard admins use to create servers, Azure presents the high-performance VMs as the default. Click on "View All" in the top right-hand corner of the dialog to reveal the range of server sizes. A0 is small and costs significantly less than Microsoft's suggested options, which makes it ideal for experimentation.

Range of server sizes
Figure 1: The A0 server size is the smallest and least expensive option.

A0 is also oversubscribed, which means CPU performance varies based on other workloads in the node. The lower tiers also do not support load balancing and have other limitations, but the VMs in those levels make for ideal inexpensive test machines.

Admins also have a disk choice to limit Azure costs. To build an IaaS VM, there are two options: hard disk drives or solid-state drives (SSDs). Standard disks are good enough for most workloads with speeds up to 500 IOPS, depending on the configuration. If speed is not a concern, avoid the more expensive SSD choices.

Aside from IaaS, there are other options that many users are unaware of or fail to understand.

Implement services as a service

Some administrators new to the cloud see it as pure IaaS where everything needs to run on its own VM. This is an option -- but an expensive one.

A move to a less expensive Azure region makes a noticeable difference when it involves several dozen servers.

Instead, think of that SQL Server and all the associated costs for compute, storage and licensing. Why deal with the price and deployment headaches, and instead just use the SQL Server as a service? It's cheaper -- a Standard_B4ms VM (four cores, 16 GB of RAM) with SQL standard costs about $383 a month while an Azure setup for multiple databases costs $224 a month on a standard tier. Plus, SQL as a service saves the administrator from the patch and update process.

Check your company's security requirements to see if it clears the use of database servers in the cloud. Because these databases are on a shared resource with potentially hundreds of other companies, an exploit or misconfiguration could leak data outside the organization.

Analyze the cost of cloud resources

Admins must understand business requirements and know what costs they bring before a move to the cloud. On-premises compute has inefficiencies and sprawl that add expenses, but the lack of a monthly bill for most environments lets those costs fly under the radar.

By the same token, it's vital to know the cloud environment's requirements and the expenses for applications and infrastructure. Use Microsoft's Azure calculator to work out the potential price tag.

Bundle resources for easier management

Admins should tap into resource groups to further control Azure costs. This feature collects the service resources, such as the VM, database and other assets, into a unit. Once the business no longer needs the service, the admins remove the resource group. This avoids a common housekeeping problem where the IT staff missed an item and the charges for it show up in the next bill.

Efficient code makes a difference

In an on-premises scenario, admins overcome inefficient code with additional resources. In the cloud, where every item has a cost per transaction or per second, better programming lowers expenses.

For example, an inexperienced database programmer who builds an additional temporary database, costs the company more money each time a new one spins up in the cloud. As this inefficient practice multiplies with each deployed instance, so does the cost. A better programmer with a more thorough understanding of SQL avoids this waste and builds code that takes less time to run.

Good programmers require higher salaries, but for a company that uses the cloud to scale out, that expense is worth it. The business saves more in the long run because lower resource utilization -- thanks to better code -- results in a smaller bill from Microsoft.

Next Steps

How Azure users can avoid higher Oracle licensing bills

Five steps to control cloud storage costs

Azure Stack adopters might need a hand

Dig Deeper on Microsoft cloud and virtualization