Scale-to-zero dev environments in Azure: cut costs without breaking developer flow
Most Azure dev environments cost too much for one simple reason: they run 24/7 even though developers don’t. The waste is predictable-idle app services, always-on container workloads, databases sized for “just in case”, and shared environments that nobody wants to turn off because they might break someone else’s work.
A cheaper pattern is to treat dev as ephemeral by default:
- services scale down to zero when idle,
- databases auto-pause,
- and whole environments can be created and destroyed on demand.
This is how you reduce cost without turning day-to-day development into friction.
The core idea: separate “exists” from “running”
In Azure, there are two different cost categories:
Resources that cost money merely by existing
- e.g. some dedicated compute SKUs, reserved capacity, certain networking setups
Resources that cost money mostly when they run
- e.g. serverless/consumption compute and auto-pausing databases
To build a scale-to-zero dev setup, bias everything towards category (2), and keep category (1) as small as possible.
Compute: pick platforms that scale to zero
Azure Container Apps (ACA) for web APIs and workers
Azure Container Apps can run containerised workloads and scale based on HTTP requests and events. Critically, when a revision is scaled to zero replicas, there are no resource consumption charges. (learn.microsoft.com)
Practical points that affect dev cost:
- Min replicas: set to
0for dev so it can scale down completely. If you set min replicas > 0, you can still be billed (including “idle” charges in certain conditions). (learn.microsoft.com) - Workload profile matters: the default Consumption profile supports scale-to-zero; some other profiles do not (for example, “Flexible” is stated as not able to scale to zero). (learn.microsoft.com)
- Scaling rule choice matters: some scaler types (such as CPU/memory-based KEDA scalers) do not support scaling to zero by design, which can leave you stuck at 1 replica. (learn.microsoft.com)
Also be aware of the non-obvious “background” costs that often sneak in:
- log/telemetry ingestion,
- networking components (private endpoints, vNET integration),
- and any shared environment resources that remain allocated even when apps scale down (often the real reason “scaled to zero” doesn’t mean “£0”). A typical example is a dev ACA needing private connectivity, which can still create ongoing costs even when the app itself scales down. (learn.microsoft.com)
Azure Functions for scheduled jobs and event glue
Azure Functions on the Consumption plan can scale to zero when idle, with the trade-off of cold starts. (learn.microsoft.com)
If you need vNET integration and still want serverless-style scaling, Microsoft’s Flex Consumption plan explicitly supports scale to zero and adds vNET integration, with options to reduce cold starts via always-ready instances (which you pay for). (learn.microsoft.com)
Dev guidance:
- prefer Functions for “glue” and background event processing,
- avoid paying for always-on compute just to run a handful of tasks per day,
- accept cold start in dev (it’s a dev environment), but keep a path to mitigate it when needed.
Database: use Azure SQL Serverless to auto-pause
For dev databases, Azure SQL Database serverless compute tier is often the simplest lever. It scales compute up/down and can auto-pause during inactivity, billing only storage while paused, then auto-resuming when activity returns. (learn.microsoft.com)
Practical implications:
- it is well suited to dev and test environments that sit idle for long periods,
- auto-pause/resume introduces a wake-up delay (usually acceptable in dev),
- you still pay storage, backups, and any extra features you enable.
Make environments disposable: ephemeral by branch, not shared forever
The cheapest dev environment is the one you delete.
A pattern that works well:
- one shared integration environment (kept small, optionally always on),
- ephemeral environments per branch/PR that are created automatically and deleted automatically.
This requires three things:
Infrastructure as Code
- Bicep/Terraform for resources
- “environment” as a parameter (name, tags, SKU choices, retention policy)
Automated lifecycle
- create on PR open (or on demand)
- destroy on PR merge/close
- “time-to-live” cleanup job for forgotten environments
Data strategy
- synthetic seed data or snapshots
- avoid copying production data into ephemeral dev
If you do this, “turn it off at night” becomes largely irrelevant because the environment doesn’t exist after the work is done.
Control the expensive parts: networking and observability
Scale-to-zero compute plus serverless SQL can still produce a bill if you treat dev like prod in these areas.
Networking
Private endpoints, vNET integration, NAT gateways, firewalls and similar components can create baseline monthly costs regardless of app activity. This is commonly where dev environments leak spend. (learn.microsoft.com)
Strategies:
- only enable private networking in dev where you truly need it,
- keep one “secure dev” environment for testing those flows,
- keep most ephemeral dev environments on simpler connectivity.
Observability
Centralised logging is valuable, but dev telemetry can be noisy and expensive. Strategies:
- reduce log verbosity in dev,
- sample traces aggressively,
- send detailed telemetry only from shared integration/staging,
- apply retention limits to dev log workspaces.
Cost guardrails: make “left running” someone’s problem (automatically)
Even with scale-to-zero, you want hard controls:
- Tags:
env=dev,owner=...,ttl=... - Budgets and alerts per subscription/resource group
- Policy: restrict expensive SKUs in dev subscriptions
- Scheduled teardown: delete environments with no deployments in X days
- Low default limits: cap max replicas/max scale-out in dev so bugs can’t create runaway usage
A reference architecture that stays cheap
A common low-cost dev setup looks like:
- Azure Container Apps (Consumption profile) for API + worker, min replicas 0 (learn.microsoft.com)
- Azure Functions (Consumption or Flex Consumption if vNET required) for scheduled/event glue (learn.microsoft.com)
- Azure SQL Database Serverless with auto-pause enabled (learn.microsoft.com)
- Storage queues/blobs where needed
- One shared integration environment, plus ephemeral PR environments with TTL cleanup
Closing thought
Reducing dev cost in Azure is mostly about discipline:
- choose compute that can scale to zero,
- choose databases that can pause,
- and stop treating dev environments as permanent fixtures.
Once environment lifecycle is automated, cost becomes a by-product of activity rather than a standing charge for forgetting to switch things off.
If you want help implementing this and bringing your Azure bill down, Red Marina can help-get in touch and we’ll walk through your current spend and the quickest savings.