You might have a question, i.e., how to stop SQL Azure DB when not in use. It is needed because there is no point in paying for the Azure SQL Database when you are not using it. Now, Azure SQL Database Serverless is the answer to the question of how to stop SQL Azure DB when not in use.
Table of Contents
- Azure SQL Database Serverless Database
- Wrapping Up
Azure SQL Database Serverless Database
Serverless is essentially a compute tier designed for single databases, allowing you to bill only for the compute used per second. It scales resources based on demand and, most importantly, pauses the database when it’s inactive. You will only be billed for the storage, not the compute, during that time.
The database resumes automatically with the next login or if anyone performs any activity in the database.
Understanding Azure SQL Serverless Architecture
Azure SQL Serverless represents a shift in database models. Unlike traditional provisioned databases, where you pay for constant compute capacity, serverless automatically scales compute resources based on workload demand and bills you only for what you use.
Core Components of Azure SQL Serverless
The serverless architecture consists of several key components that work together to deliver automatic scaling and cost optimization:
- Auto-scaling Compute: Dynamically adjusts vCores based on workload demands
- Auto-pause Functionality: Automatically pauses databases during inactive periods
- Storage Separation: Decouples storage from compute for independent scaling
- Instant Resume: Quickly resumes paused databases when activity is detected
Key Features Of Serverless Tier
There are a few key features available in the serverless tier. Those are as follows.
Autoscaling Capability
It automatically scales the compute resources based on the workload or demand, which improves the performance.
Best Memory Management
In the case of a serverless database, the memory recovers frequently, which helps to control the cost. Manages memory effectively through cache reclamation and Cache hydration.
Auto-pausing
Auto-pausing is another essential feature of a serverless database. Suppose the system finds the number of sessions to be zero and the CPU usage to be 0 for the user workload running in the user pool. This mainly helps you to control the cost.
Auto-resuming
It resumes the database automatically in a few scenarios, like on the next login, to modify the threat detection settings, to view the auditing records, To add, edit, view sensitivity levels, To add, edit, delete, view data masking rules, To view, modify query store settings, To view or apply performance recommendations, In case of auto-indexing, To export a database, To add the new database tags, etc.
When to Use Azure SQL Serverless
- Development and Testing Environments
- Intermittent Workloads
- Small to Medium Applications
- Single databases that are not continuous or steady
- Single database without usage history
- Single databases that are inactive for a long time, etc.
Scenarios to Avoid
| Scenario | Reason to Avoid | Recommended Alternative |
|---|---|---|
| High-frequency OLTP | Frequent pause/resume cycles | Provisioned compute |
| Predictable 24/7 workloads | No cost benefit from auto-pause | General Purpose tier |
| Memory-intensive applications | Limited memory scaling options | Business Critical tier |
| Applications requiring <1 second response | Resume latency considerations | Always-on provisioned |
Setting Up Azure SQL Serverless
Method 1: Azure Portal Configuration
Here’s the complete setup process:
-- Step 1: Create serverless database via T-SQL
CREATE DATABASE [CustomerAnalytics_Dev]
(
EDITION = 'GeneralPurpose',
SERVICE_OBJECTIVE = 'GP_S_Gen5_1',
MAX_SIZE = 100 GB,
COMPUTE_MODEL = 'Serverless'
);
Portal Configuration Steps:
- Navigate to Azure SQL Database creation
- Select “Configure database” under Compute + Storage
- Choose “Serverless” compute tier
- Configure auto-pause settings (1 hour to 7 days)
- Set minimum and maximum vCore limits
Check out the screenshots below for your reference.


Cost Calculation for a Serverless Database
- The first and essential point to note is that when the database is paused, you need to pay for storage, and during that time, you do not need to pay any amount for compute.
- In the case of the Serverless Database, the total cost is the addition of the Storage Cost and the Compute Cost.
- Remember that the cost calculation for the Compute is based on a few factors. If you have used the compute resources within the minimum and maximum limits, then the cost is based on the vCore and memory you have used. Whereas, if you have used the compute resources below the minimum and more than the maximum, the cost is based on the minimum vCores and minimum memory you have used.
- The storage cost, as usual, is based on the storage you use and is payable accordingly.
Cost Optimization Strategies
Understanding Serverless Billing Model
Billing Components:
- Compute: Billed per second for active usage only
- Storage: Billed monthly for allocated space
- Backup: Additional charges for backup storage beyond 100% of the database size
Cost Calculation Formula
-- Serverless cost monitoring query
SELECT
start_time,
end_time,
avg_cpu_percent,
avg_data_io_percent,
avg_log_write_percent,
max_worker_percent,
max_session_percent,
DATEDIFF(second, start_time, end_time) as duration_seconds,
-- Estimate compute cost (example pricing for East US)
(DATEDIFF(second, start_time, end_time) / 3600.0) * 0.54 as estimated_hourly_cost
FROM sys.dm_db_resource_stats
WHERE start_time >= DATEADD(hour, -24, GETUTCDATE())
ORDER BY start_time DESC;
Optimization Best Practices
Minimize Cold Starts: Based on my experience with a fintech startup in San Francisco:
-- Keep connections warm with scheduled maintenance
CREATE PROCEDURE sp_KeepServerlessWarm
AS
BEGIN
-- Lightweight query to prevent auto-pause during business hours
IF DATEPART(hour, GETDATE()) BETWEEN 8 AND 18
BEGIN
SELECT COUNT(*) FROM sys.objects WHERE type = 'U';
WAITFOR DELAY '00:15:00'; -- 15-minute intervals
END
END;Wrapping Up
In this article, we discussed the Azure SQL Database Serverless option. Thanks for reading this article !!
You may also like the following articles.

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
