Investigating and fixing an Azure cost spike: Cost analysis by service, resource and meter, Log Analytics usage queries, common runaway causes, budgets and anomaly alerts, tagging and Azure Policy guardrails, and FinOps habits.
I treat it like an incident. In Cost Management → Cost analysis I group by service, then resource, then meter, with daily granularity, to find what grew and the day it started. Then I correlate that date with the release history and the Activity Log to find the deployment or config change behind it. Common culprits are Log Analytics ingestion from debug logging, a SKU scaled up and never scaled down, autoscale with no sensible maximum, forgotten test resources, and recursive triggers.
I stop the bleeding first (daily cap, scale down, disable the loop), then fix the root cause, then add guardrails: budgets with action groups, cost anomaly alerts, required tags, Azure Policy for allowed SKUs, and OpenTelemetry sampling. The trade-off is that guardrails like hard caps can drop data or block scaling, so they must be set deliberately, not as a reflex.
"I treat a cost spike like a production incident: find it, contain it, fix it, prevent it. First I open Cost Management, Cost analysis, on the subscription, daily view for the last two months, and group by service name. That tells me what kind of thing grew, for example 'Log Analytics' or 'Azure SQL Database'. Then I group by resource and by meter to find which resource and which charge, such as 'Analytics Logs Data Ingestion'. The day the line bends usually matches a deployment or a config change, so I check the release history and the Activity Log for that day.
For example, at [company] our bill went from [A$9,000 to A$27,000] in a month. Cost analysis showed [almost all of the increase] was Log Analytics ingestion on one workspace. A KQL query on the
Usagetable showedAppTracesgoing from [3 GB to 180 GB] a day, starting the day we [deployed a release that set the default log level to Debug and turned on EF Core command logging]. I set a daily cap on the workspace as an immediate stop, reverted the log level through App Configuration without a redeploy, and then we added sampling and log-level rules per category. [The next month's bill was back to about A$9,500], and we added cost anomaly alerts so a spike would page us in a day, not a month.The mistake I see is relying on budgets as protection. An Azure budget only sends an alert, it doesn't stop anything, and the default monthly view means you find out weeks late. I want daily anomaly alerts, tags that tell me who owns each resource, and policies that block the expensive SKUs nobody should create by accident. Cost is a non-functional requirement like latency, so it gets the same monitoring."
| Step | Tool | What you learn |
|---|---|---|
| 1 | Cost analysis, group by service, daily | Which service grew, and when |
| 2 | Group by resource, then meter | Which resource and which charge |
| 3 | Activity Log, release history | What changed that day |
| 4 | Service metrics or KQL (Usage table) |
Why the meter grew |
| 5 | Azure Advisor cost recommendations | Idle or oversized resources |
| Cause | Meter that grows | Fix |
|---|---|---|
| Debug logging or no sampling | Log Analytics data ingestion | Log levels, sampling, daily cap, Basic logs tier for verbose tables |
| SKU scaled up for an incident, never scaled down | SQL vCore, App Service plan | Scale down; alert on SKU changes |
| Autoscale or AKS node maximum too high, plus a hot loop | Compute hours | Sensible max; fix the loop |
| Recursive trigger (function writes to the container that triggers it) | Function executions, storage transactions | Separate input and output containers |
| Forgotten dev or load-test resources | Everything in an untagged resource group | Tags, expiry dates, scheduled clean-up |
| Cross-region or internet egress | Bandwidth | Keep traffic in region, use a CDN |
In a typical case, a single Debug-level release took Log Analytics ingestion from about 3 GB to 180 GB a day, which at pay-as-you-go ingestion rates cost several hundred dollars a day. A daily cap stopped it within an hour, and per-category log levels plus 20% sampling kept ingestion at about 4 GB a day afterwards with no loss of useful diagnostics.
Checks that the candidate can investigate a cost incident methodically and put lasting guardrails in place.
Green flags
Usage)Red flags
Every resource emits usage records per meter (for example 'P1v3 hours', 'Analytics Logs Data Ingestion GB', 'LRS Write Operations'). Cost Management joins usage to prices and shows cost by subscription, resource group, resource, service, meter and tag. Data usually lands within 8–24 hours, so today's spend isn't final yet.
Resource ─▶ usage records (meter, quantity) ─▶ rating (price sheet, discounts) ─▶ Cost Management
├─ Cost analysis views
├─ Budgets ─▶ action group
└─ Anomaly alerts
Usage
| where TimeGenerated > ago(45d) and IsBillable
| summarize IngestedGB = sum(Quantity) / 1000 by DataType, bin(TimeGenerated, 1d)
| render timechart
Then drill into the table that grew:
AppTraces
| where TimeGenerated > ago(1d)
| summarize Count = count(), MB = sum(estimate_data_size(*)) / 1e6 by AppRoleName, SeverityLevel, tostring(Properties.CategoryName)
| top 20 by MB
| Lever | Effect | Side effect |
|---|---|---|
| Log Analytics daily cap | Stops ingestion at the cap | You lose telemetry for the rest of the day |
| Scale down a SKU | Immediate saving | Less headroom if load returns |
| Disable a function or trigger | Stops a loop | Work stops; messages back up |
| Delete resources | Stops all cost | Irreversible; check ownership first |
owner, costCentre, environment, expiresOn) enforced with Azure Policy deny or modify effects.Usage KQL query on a workspace and identify the largest table.owner tag and test it with az group create.Guardrails as code: a budget with an action group, a daily cap on the workspace, and a tag policy, in Bicep. Plus the log configuration that prevents the classic ingestion spike.
targetScope = 'subscription'
param actionGroupId string
param startDate string = '2026-12-01'
resource budget 'Microsoft.Consumption/budgets@2023-11-01' = {
name: 'budget-orders-prod'
properties: {
category: 'Cost'
amount: 12000 // monthly, in the billing currency
timeGrain: 'Monthly'
timePeriod: { startDate: startDate }
notifications: {
forecast90: {
enabled: true
operator: 'GreaterThan'
threshold: 90
thresholdType: 'Forecasted' // warn before the money is spent
contactGroups: [ actionGroupId ]
}
actual100: {
enabled: true
operator: 'GreaterThan'
threshold: 100
contactGroups: [ actionGroupId ]
}
}
}
}
// Require an owner tag on every resource group so cost can be traced to a team.
resource requireOwner 'Microsoft.Authorization/policyAssignments@2024-04-01' = {
name: 'require-owner-tag-rg'
properties: {
policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/96670d01-0a4d-4649-9c89-2d3abc0a5025' // Require a tag on resource groups
parameters: { tagName: { value: 'owner' } }
}
}
// In the resource group deployment: a daily cap as a safety net, not the main control.
resource workspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
name: 'log-orders-prod-aue'
location: 'australiaeast'
properties: {
sku: { name: 'PerGB2018' }
retentionInDays: 30
workspaceCapping: { dailyQuotaGb: 20 }
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
}
}
}
ILogger exported with OpenTelemetry (the Azure Monitor distro), per-category log levels, trace sampling, and dynamic log levels through App Configuration.owner, environment and costCentre tags with Azure Policy.Senior engineers treat cost as an operational signal owned by the team that creates it, not as a finance problem discovered at month end. That is the core FinOps idea: engineering, finance and product share one view of spend, engineers get near-real-time visibility, and decisions are made on unit cost (per request, per customer) rather than the raw total. In practice I agree the budget and forecast with finance each quarter, review cost in a monthly team ritual, and explain spikes before the invoice does. The fastest wins are almost always telemetry volume, idle or oversized resources, and non-production environments running 24/7; rate discounts come after that.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| Budgets + action groups | Every subscription and major resource group | Free | As the only protection |
| Cost anomaly alerts | Catch spikes within a day | Free | Brand-new subscriptions with no history |
| Daily cap on Log Analytics | Safety net for ingestion | Lost telemetry when hit | Primary cost control |
| Azure Policy allowed SKUs | Dev and test subscriptions | Some friction for teams | Production that may need to scale up in an incident |
| Reservations / savings plans | Stable baseline compute | Commitment for 1 or 3 years | Spiky or shrinking workloads |
I measure it with cost per environment per month, cost per 1,000 requests or per customer (unit economics), Log Analytics GB per day, and the share of spend that is tagged. For scripted checks, az costmanagement query or the Cost Management exports to a storage account feed the same numbers into a dashboard.
I choose by how much platform the team wants to run:
The trade-off is control versus operations: each step towards AKS gives more control and more work. I start with the simplest option that meets the requirements and move only when I hit a concrete limit.
I build it in layers:
The trade-off is cost and complexity (private DNS, more resources) versus a much smaller attack surface and a tested recovery path.
A typical .NET team uses a small, repeatable set of Azure services:
Everything is wired together with managed identity and Entra ID RBAC, not connection strings, and deployed with infrastructure as code. The trade-off: managed PaaS services remove patching and plumbing, but you accept each service's limits, pricing model and region availability.
How to tell it (STAR)
**S:** Our team's Azure bill tripled in a month, from about [A$9,000] to [A$27,000], and we found out from the invoice. **T:** I took ownership of finding the cause and stopping it happening again. **A:** In Cost analysis, grouping by service, resource and meter showed almost all of it was Log Analytics ingestion on one workspace. A KQL query on `Usage` showed `AppTraces` jumping from [3] to [180] GB a day on the day we shipped a config change that set logging to Debug. I capped the workspace, reverted the log level through App Configuration within the hour, then added sampling, per-category log levels and anomaly alerts. **R:** The next month came in at about [A$9,500], ingestion settled at around [4] GB a day, and a later spike was caught by the anomaly alert within [24 hours].
Last updated 23 Nov 2026.