"Azure SQL Database went up" is a start, not an answer. Which database? And was it compute hours or stored data? The service view of your bill cannot say, because it is the wrong grouping for that question.
Most cost questions are answered by the same move: pick the grouping that matches the question, list every item, and compare each one with the period just before. You can do it with Cost analysis and a spreadsheet.
Step 1: pick the grouping that fits the question
In the Azure portal, open Cost Management > Cost analysis on the subscription or billing scope, and use Group by:
- Service name: which product family costs most. Good for a first look.
- Resource group name: which environment or team, if your groups follow them.
- Resource: which single database, app or storage account.
- Meter: what you are billed for inside a service: compute hours, stored data, operations, data transfer. Several resources can share one meter.
- Subscription: only useful on a scope that holds more than one.
A rule of thumb: go one level down from where the surprise showed up. A service grew? Group by resource, then by meter.
Step 2: export two equal periods
- Set the date range to the last 30 complete days. Azure publishes cost a day or two late, so leave the newest day or two out.
- Download the grouped view as CSV.
- Do the same for the 30 days just before, with the same grouping and the same scope.
The two periods must have the same number of days, or every change you compute is skewed.
Step 3: join them and compute four columns
Put both exports in one sheet, joined on the item name (XLOOKUP or a pivot table works). For each item compute:
- Cost in the recent period.
- Share: cost divided by the total of the list. Take the total from the same export, not from another screen, so shares and costs cannot disagree.
- Previous period: the cost in the earlier 30 days.
- Change: recent minus previous, in money, and as a percentage of the previous cost.
Sort by cost, largest first.
Step 4: keep the rows people drop
Three kinds of rows usually fall out of a hand-made comparison, and they are often the interesting ones:
- New items: a cost now, nothing before. A percentage makes no sense here (there is nothing to divide by), so label them "New" instead of showing a huge number.
- Gone items: a cost before, nothing now. A lookup from the recent list never finds them. List them separately; they explain part of a falling total, and they confirm that a cleanup really happened.
- Items without a name: some cost is recorded against the subscription itself, not a resource group or a resource. A reservation purchase or a support plan are typical. Keep them as rows of their own, or your list no longer adds up to the invoice.
Step 5: read the list
- A large share with a small change is your baseline. It matters for architecture decisions, not for this month's surprise.
- A small share with a large change is where to look first. The same resource grouped by meter then says whether compute, storage or traffic moved.
- Do not colour rises red and falls green. A rise can be planned growth, and a fall can be an outage.
- If the scope is billed in two currencies, do one sheet per currency. Adding them without an exchange rate gives a number that means nothing.
Doing it without the spreadsheet
The steps above are worth doing once by hand. Repeating them for every question is the tedious part.
(I build CostGuard, an Azure cost tool on Azure Marketplace with a Free plan, so weigh this accordingly.) Its Cost Explorer page does this for the scope you pick: you choose service, resource group, resource, meter or subscription, and it lists every item with its cost, its share, its cost in the same number of days before and its change. Items with no cost before are marked "New", items billed only in the days before are named under the list, and cost without a resource group or a resource keeps a row of its own.
It only reads cost: the connection uses the built-in Reader role, so it cannot change anything in your Azure.
Honest limits
- Cost data arrives a day or two late, by hand or in any tool, so a range that ends today is not final.
- A comparison says what moved, not why. Someone still has to know that the new replica was planned.
- CostGuard holds no exchange rates: each currency is listed on its own and nothing is converted.
- Cost Explorer is on the Starter plan and up; the Free plan shows a labelled sample of the page.
The full walkthrough of the page: https://hoshebartar.com/en/help/cost-explorer?utm_source=devto&utm_medium=article&utm_campaign=kb-cost-explorer
Which grouping do you reach for first when an Azure bill surprises you: service, resource group, resource or meter?

Top comments (0)