Imagine that you’ve deployed something in Azure, expecting it to cost $200 per month, but instead find that your boss gets a bill for $1,000. That’s when your boss will ask you to find out how the money disappeared. In this article, I’ll help you understand how much you are really spending in Microsoft Azure.
Step 1: Understand Azure Pricing
If you want to know where you are spending in Azure, then you need to understand:
- What you have deployed
- How the elements that make up the solution are priced
I have to be blunt here: it’s quite a mammoth task to learn how Azure pricing works. Azure is a utility, so your services are measured and charge on a utilization basis. There is no “pricing for a VM in the cloud”; instead, the solution will be comprised of billable items that potentially include the following:
- Virtual machines
- Standard storage for virtual machine disks
- Premium storage for virtual machine disks
- Storage transactions
- Azure backup for virtual machines
- Standard storage for Azure backup
- VPN gateway for hybrid networking
- Outbound data transfers, or data that’s leaving the Azure region
To be honest, most of the costs are pretty predictable. If I deploy a D2 v2 virtual machine in East US 2, then I know that it will cost $0.289 per hour, averaging around $215 per month. Storage for virtual machines is pretty predictable, too. I’m the one responsible for creating and sizing my data disks.
Costs that are more difficult to estimate include:
- Outbound data transfers
- Storage transactions
To be honest, both costs are usually quite small in the grand scale of things. In fact, Microsoft even removed storage transaction pricing from the storage pricing site.
Other costs are painfully complicated; a perfect example of that is Premium Storage, which is based on disk abstractions called P10, P20, and P30, which only a fan of tax law could be a fan of. SSD storage in Azure is based on units of each of these specifications, and sometimes those units are expressed as a fraction (in decimal form). I have no idea why Microsoft couldn’t bill based on GBs consumed, as they do with Standard Storage.
Once you know the design and specification of your solution(s), then estimating the pricing those solutions is not too hard, and it gets easier with practice, especially if you start to compare what has been deployed versus what has been consumed.
Step 2: Investigate the Azure Portal
The Azure Portal is very good at presenting information to administrators. You can customize the blades of elements in your subscription to see how much they are costing you. You can also browse to your subscription in the portal to view the burn rate; This shows how much credit remains and a high-level graphical breakdown of how credit is being consumed. Below you can see that the majority of my credit has gone on “compute hours,” AKA virtual machines.
If I click on the above chart, a Resource Costs blade will open and give me a text-based break down of spending. Here I can see the number of credit consumed by every category of billable resource.
Note how storage transactions, a metric everyone fears in Azure at first, cost me just €0.08, which is around $0.09. This is why I say the cost of estimating the cost of storage transactions will be higher than the actual cost of storage transactions.
Step 3: The Account Portal
If you want forensic information, then the Account Portal is the place to go. Log in with an account with privileges for the Azure subscription and browse into the subscription in question.
You are greeted with a high-level breakdown, similar to above, of your spending in the current billing period. You can expand any item to get a chart view of spending during the last 10 days.
If you want to get more data or to go back further in time, then you should click Download Usage Details. This opens up a screen that allows you to download a spreadsheet for the current or past billing period; this is the really meaty accounting information.
The spreadsheet has two sections. The Statement area is a summary of utilization and billing, similar to the summary you have seen above already. The Daily Usage section breaks down billing on a daily basis. Note how I’ve highlighted the summary and daily usage of “Azure A1 VM.” This spreadsheet allows you to track usage on a daily basis and identify when spikes in spending started.
Unfortunately, this spreadsheet does not identify exactly which virtual machine was consuming my credit, but armed with this information, I can return to the Azure portal, and expand the blades of each machine to see what the cost of it has been.