Cut Off-Hours Azure SQL Database Cost: What Can Pause
Azure has no stop for provisioned Azure SQL Database. The one real lever is the serverless tier, which can auto-pause and which ZopNight can pause on a schedule, and it has conditions you need to check first.
Searching for a way to schedule Azure SQL Database off at night usually ends in the same place: the az sql db command group has create, update, copy, restore and delete subcommands, but no stop, pause or start. What Azure offers instead is the serverless compute tier, which pauses a database by itself after a period of inactivity. This page shows how to check whether that applies to you and how to turn it on.
Which databases can pause at all
Per Microsoft’s serverless documentation:
- Auto-pause and auto-resume are supported only in the General Purpose service tier on the serverless compute model. Hyperscale offers serverless compute but not auto-pause.
- Serverless is available in the vCore purchasing model only, not DTU.
- Provisioned compute databases do not pause. Microsoft positions serverless for single databases and lists elastic pools under provisioned compute scenarios.
List the current model of each database first:
az sql db list -g rg-data -s sql-dev-weu \ --query "[].{name:name, edition:edition, sku:sku.name}" -o table1. Move a General Purpose database to serverless
az sql db update -g rg-data -s sql-dev-weu -n orders-dev \ --edition GeneralPurpose \ --compute-model Serverless \ --family Gen5 \ --min-capacity 1 \ --capacity 4 \ --auto-pause-delay 60--auto-pause-delay is in minutes. The minimum is 15, the maximum is 10,080 (seven days), the default is 60, and -1 disables pausing. Changing the delay later is the same command with only that flag.
2. Remove what keeps it awake
A database pauses only when sessions and user CPU both sit at zero for the whole delay. These features prevent auto-pause entirely, so Microsoft says to disable auto-pausing if you use them:
- Active geo-replication and failover groups
- Long-term backup retention
- A DNS alias on the logical server
- Being the sync database for SQL Data Sync
Monitoring and admin tools also resume a paused database: viewing auditing records, Query Store settings, performance recommendations, or changing tags on the database all count as activity. Microsoft notes that SSMS versions earlier than 18.1 resume every auto-paused database on the server when you open a query window.
3. Verify it paused
The database reports one of four statuses: Online, Pausing, Paused, Resuming.
az sql db show -g rg-data -s sql-dev-weu -n orders-dev --query status -o tsvThe Activity log shows each pause and resume, and for resumes the Caller field tells you what woke it. Expect auto-pause to take 1 to 10 minutes after the delay and auto-resume around a minute, so applications need connection retry logic.
What still bills
While paused, compute cost is zero and only storage is charged. Serverless compute bills per second when running, against a floor set by --min-capacity.
If the database cannot go serverless
For Business Critical, DTU, elastic pool or geo-replicated databases, the options are scaling down to a smaller service objective outside working hours with az sql db update --service-objective, consolidating into an elastic pool, or deleting non-production copies and restoring from backup when needed. None of these is a stop.
ZopNight and Azure SQL
ZopNight can pause and resume Serverless-tier Azure SQL databases on a schedule; provisioned and DTU databases cannot be paused. Its remediation pause step excludes Azure SQL databases, because remediation does not change customer databases. It still discovers them and reports their cost alongside the rest of the subscription. For eligibility detail by tier, see the Azure SQL Database directory page; for flexible servers, which do have a real stop, see PostgreSQL Flexible Server scheduling.