How to Not Lose Control Over Costs in Microsoft Azure

It’s easy to create cloud resources, and it’s just as easy to spend hundreds if not thousands of dollars on said resources. So it’s good to know that there are many tools to help you manage your costs.

Many services in Azure have a flat rate, but there are also charges that occur on a per-use basis. Let’s take Azure SQL, for example. Azure SQL’s general purpose (Gen 4) price for a 2-core and 14 GB memory server is $0.5044 per hour. However, what doesn’t show up in the Gen 4 price chart is that each time you create a new database, you’ll be charged depending on the pricing tier for that database.

Luckily, Microsoft Azure has built-in features that allow for managing costs and funds spent. In this blog post, you’ll learn how to set a company up for success by having the cloud infrastructure you need, without going over budget.

Understanding the Azure Billing Model

Azure has a unique billing model that allows for different options depending on your organization.


The pay-as-you-go model means you only pay for what you use without commitment. This, like most Azure services, allows for an hourly rate per usage. For example, let’s say you are using an A7 eight-core Azure virtual machine that costs $1.32 per hour, and you need the virtual machine for four hours.

This will add up to the following:

  • The virtual machine itself will come out to $5.28.
  • The standard hard disk drive will come out to $1.536

You may be wondering why you have to pay extra for the standard hard disk drive. By default, the virtual machine does not come with any additional components or features. Anything that is added to the virtual machine, including the operating system if it’s Windows, is an added cost. 

The pay-as-you-go model is great if you need a development environment for a few hours or a few days. But as you can imagine, these costs can get out of hand. For instance, it’s very easy to create a virtual machine in Azure and then forget it’s on. Taking a look again at the above example, that dollar amount is only for four hours. If that same virtual machine was running for an entire month, the cost would go up to $963.60!

Always keep an eye on the bill even if you know you’re doing everything right because there’s always a chance that you may be charged too much or too little. There have even been cases where a customer is charged too much due to a bug in Azure that requires a bit of adjusting and a refund to the customer. 

Reserved Instances

If you’re running multiple workloads and expect to stay with Azure, there are some options that can reduce your costs, such as reserved compute.

Reserved computing resources allow you to buy dedicated virtual machines, saving upwards of 72% (see here) compared to the pay-as-you-go model. Reserved instances are great if you know you’ll be staying with Azure because you have to reserve for an extended period of time.

Currently, there are two reserve options:

  • One-year reserve
  • Three-year reserve

Taking the same virtual machine example from the Pay-As-You-Go section above, the one-year reserve plan would save you roughly $27.00 dollars per month, while the three-year reserve plan would save you roughly $48.00 per month. By looking at the numbers, this doesn’t seem like a big difference, but this is just for one virtual machine. Imagine if you had 50 or 100 virtual machines. In those cases, reserved instances would be saving you thousands of dollars.

With the one-year and three-year reserved plans, there are two ways of paying:

  • For enterprise agreement (EA) customers, the Azure Monetary Commitment is used to purchase the reserved instances.
  • If the organization does not have an Azure Monetary Commitment, the organization will have to pay for the full one-year or three-year commitment upfront.

Many organizations wonder, “How can I stop my Azure bill from skyrocketing?” The answer to this question is not so easy with the Pay-As-You-Go model because by the time an organization reaches the Azure cap allowed, the company is well over budget. Implementing reserved instances removes the “what if?” from the organization’s financials.

Azure Government

If you are a government entity, Azure provides a separate plan to meet all security and compliance needs. Government pricing will differ between agencies, but it’s typically much lower than the standard organization’s pricing. In fact, Azure Government users get a 90-day free trial with a $500.00 credit, while the standard organization gets a 30-day free trial with only a $200.00 credit.

Cost Management

To understand how much you may spend per month, or year, take a look at the Azure Pricing Calculator. The calculator allows you to specify hours per resource, giving you an estimate of what your total cost will be.

Even with an Azure Government contract, there are still ways for an Azure bill to skyrocket. So here are the top five Azure best practices that can help you cut costs by, in some cases, as much as 30%.

  • Consider the type of virtual machine you are using. For a D-series machine, ensure that the application or workload running actually needs that much power. If not, perhaps think about scaling down to a B-series.
  • Check resource groups for unused disks. Many times, virtual machine disks can be changed and upgraded or the virtual machine is removed, but the storage disk is not.
  • Check how many databases are running in Azure SQL and confirm they are needed. Azure charges for each database that is created within Azure SQL, even test databases. So make sure that the databases running are essential.

Monitoring Usage and Spending

Monitoring the usage of cloud resources is crucial. It’s very common to spin up an unnecessary amount of compute or storage and end up using only 10-15%. You can easily downsize these resources. The application or server will not be negatively impacted, and your organization will save a lot.

In many cases, engineers will use defaults when creating resources, for example, a virtual machine. The issue is that resources like virtual machines have very large default sizes that are not needed most of the time for a standard workload. 

When a friend of mine and his team started implementing Azure Resource Manager templates, they started with the QuickStart templates found on GitHub. The team didn’t know much about Azure Resource Manager or the syntax, but they knew that management wanted them to move faster with virtual machine deployments, specifically for development and testing environments for the application that was being deployed. The developers were getting antsy about having the ability to test their application at any given time.

Before even having the chance to learn Azure Resource Manager syntax, management just wanted the team to implement the virtual machine automation, so they went ahead with the defaults. However, what management hadn’t expected–and certainly didn’t want–was a bill from Azure at the end of the month for $11,000.


Budgeting plays a huge role when considering usage of resources. Each organization must have a quarterly budget that gives an approximate spending limit. Most departments do this manually, leaving room for failure. To ensure this is done in an automated fashion, there are several predefined automation practices in place.

Below is a screenshot of an ARM template from the quickstart templates found here.

The key feature in the ARM template below is the time period for startDate and endDate. This allows you to specify your budget frequencies.

Figure 1: Example ARM template

Monitoring Usage

In the Azure portal under subscriptions, there is a rough estimate/forecast on what the spending will look like based on previous billing periods. Not only that, but Azure will also show if the subscription is likely to exceed the usage limit.

Figure 2: Spending rate & forecast
Figure 3: Gauging Azure spend in the Azure portal

Automate Consumption Usage

Azure makes knowing what the consumption usage will look like easy and fun. Why fun? Because the developers get to automate it with code.

With the Azure Command-Line Interface (AZ CLI), developers can use the az consumption command-line tool to list consumption by a particular invoice or within a billing period. The line below will give a detailed history of the consumption usage throughout the entire subscription.

az consumption usage list --subscription subscription_id

Advisor Recommendations

Under Cost Management —> Advisor recommendations, there will be one to many recommendations based on the environment. Advisor recommendations can help you see where you can save money.

Figure 4: Cost-saving recommendations in the Azure portal

The top five typical recommendations for saving money in the industry are:

  • Turn off or resize virtual machines: This is based on Azure analyzing the existing resources and the resource usage. If the resource usage is low or not used at all, Azure will recommend to turn it off or resize.
  • Upgrade with no additional cost: This is based on resources that can be upgraded for free without any cost to the user. For example, you can upgrade premium VM unmanaged disks to managed disks for free.
  • Follow Azure recommendations: Azure will judge performance and resource availability based on existing services and often tell the customer where they can improve, for example, by following SQL DB server recommendations.
  • Recommendations for unsupported services: Azure will let you know when a service is unsupported, even though you can continue to use it. For example, an old version of Kubernetes on Azure will still work, but Microsoft may not be able to offer support when you need it.
  • Alerts: Azure wants you to know what is happening with your resources as frequently as possible. So you may see recommendations for low-risks as well, like creating an Azure service alert policy because it’s important to know if an Azure service goes down or is having intermediate connectivity issues.


While it’s important to monitor and understand what’s necessary for cloud resource sizing, it’s also important to get alerts. Monitoring solves the live interaction with the system, meaning what’s happening at the exact second that an engineer is looking at the monitor. But it doesn’t solve the 1:00 a.m. wake-up call when there’s an alert that needs action.

Azure also allows you to easily set up budget alerts that notify you about spending or usage based on a predetermined amount. Department spending alerts allow you to set up a percentage per department (IT, infrastructure, DevOps, Database teams, etc.) for what resources can be used. 

In this section, you’ll take a hands-on approach by creating cost management alerts for when the subscription billing goes over a specified amount.

Cost Management Alerts

Under the Cost Management + Billing portal, there’s an option for Cost Management. Cost management allows you to set monthly budgets and alerts based on the subscription.

Figure 5: Cost Management node in the Azure portal
Figure 6: Create a budget button

By creating a budget, you can easily set caps based on dollars spent, when the budget should start, and when it should end.

Figure 7: Setting spending caps

Cost Management Best Practices

To keep costs under control, organizations can adhere to a few tips of the trade or best practices. These activities should be performed on a regular basis and should be a combined effort from all teams in an organization. We’ll leave you with a few tips to help you finally corral all of those Azure costs once and for all!

  • Check virtual machine sizes. Many virtual machines are sized too large. This is because a larger size is typically picked by default. Ensure that the workload of the virtual machine running needs all of that CPU and memory.
  • Look into reserved instances if the resources you’re using will 100% be used for at least one year. As mentioned in the above section Understanding the Azure Billing Model, reserved instances can save you a significant amount of money. The best way to check if reserved instances will save the organization money, use the Azure Pricing Calculator to add up the dollar amount per year for Pay-As-You-Go resources. If the dollar amount exceeds what you would pay for a reserved instance, it’s time to further evaluate the reserved instance path.
  • Quarterly audits on resources. Ensure your tech leads sit down and understand if they need all of the resources that are running. Chances are, there are services that are no longer required.
  • Plan with the cost of the service in mind. Understand the cost upfront so you don’t run into any surprises.
  • Create budgets per department. Budgets should be evaluated on a quarterly basis because tech needs are constantly changing. Understand what is needed per department to ensure productivity and efficiency throughout the organization.


In this blog post, you learned how to hit the ground running and change the way your organization manages its costs. Getting a clear picture of each billing model helps companies understand the path to take. Once this path is clear, management can break down usage and optimize efficiency for cloud compute resources. Once this efficiency is defined, understanding what best practices fit your organization comes into play.

Related posts