By: Rajendra Gupta | Updated: 2024-07-31 | Comments (1) | Related: > Azure SQL Database
Problem
Would you like to have access to Azure SQL Database for free forever? If so, read this article to learn how Azure offers a free Azure SQL Database serverless configuration for a lifetime.
Solution
Azure offers a free-tier account to create, deploy, test, and manage applications with access to popular services for 12 months without charge. After the free account period, you need to switch to the Pay-As-You-Go (PAYG) model that charges you monthly for the product or service usage over the month. However, if you are looking to explore Azure SQL Database beyond the free tier, Azure has an offering for you.
Under this offering, Azure provides 100,000 vCore seconds of computing every month for the life of the subscription for the Azure SQL Database. It includes 32 GB of data and 32 GB of backup storage, free to use monthly. You can use this Azure SQL Database to learn, develop, and POC. To get this free Azure database, you must switch to a PAYG model in Azure, which applies to one database per Azure subscription.
Let's see how to create the free Azure SQL Database using the Azure portal.
Deploy Serverless Azure SQL Database
Search for the SQL databases after connecting to the Azure portal.
Click Create SQL database on the search results page.
A banner appears on the Create SQL Database page: Want to try Azure SQL Database for free?
Click Apply offer (Preview) to utilize this free Azure SQL Database.
Once the offer is applied, the banner will change (below).
Note: Do not click Remove offer if you want to use the Azure SQL Database freely within the defined limits.
Project Details
Choose the subscription from the drop-down.
Next, select a resource group to deploy the Azure SQL Database and its resources. If you do not have an existing resource group, click Create new and provide a resource group name. For this tip, I will provide a resource group named mssqltipsresourcegroup.
Database Details
Enter the database name. I specified the database name as mssqltipsazure.
Server Details
Click Create New Server and enter the following details:
- Server name: Enter the server name (e.g., demoserver1) and Azure appends the domain .database.windows.net.
- Location: Choose the Azure region where you want to deploy the Azure SQL Database.
- Authentication method:
You can choose to use either of the following:
- Use Microsoft Entra-only authentication (Azure Active Directory).
- Use both SQL and Microsoft Entra authentication.
- Use SQL authentication. Specify the server admin login (other than SA) and passwords.
Click OK.
Behavior when the free offer limit is reached
As stated earlier, the offer is for 100,000 vCore seconds of computing and 32 GB maximum data size. If you exhaust the free-limit offering, you have two options.
- Auto-pause the database until next month: This is the default selection. Under this option, the Azure SQL Database will be paused and inaccessible for the remaining month. You can access the database at the beginning of the following calendar month.
- Continue using a database for additional charges: For this option, the database will be continuously accessible, and you will be charged for the additional vCore usage and storage as per your subscription billing method. It will follow the standard general-purpose tier for serverless billing rates.
Let's use the default option - Auto pause the database until next month - and click Next.
Connectivity method
Choose the public endpoint for connecting to Azure SQL Database over the internet.
For additional settings, choose the data source, database collation, and preferred maintenance window on the next page.
Data Source
You can restore an existing database from a backup or create a sample database.
Let's choose the sample and click OK on the following pop-up message. It will create a sample [AdventureWorksLT] database in the Azure SQL Database.
Product Pricing
In the Review + create page, notice the estimated Azure SQL Database cost.
You can also view the details on the cost- summary page on the right side. As shown below, you get:
- First 32 GB storage free.
- First 100,000 vCore seconds free.
- Disabled overage billing using the option to Auto-pause the database until next month.
Review the Azure SQL Database configuration and click Create to deploy the General Purpose - Serverless: Standard-series (Gen5), 2 vCores, 32 GB storage with locally redundant backup storage, as shown below.
It starts the deployment and notifies you of the progress.
Connecting
Click Go to resource after the deployment is complete and note down the server name.
Launch SQL Server Management Studio (SSMS) and enter the server name and credentials for SQL Server authentication.
You might get the following connection failure due to the connection being denied public network access, which is set to Yes.
To resolve this error, go to Azure SQL Server and click on the Networking tab.
Change public network access to Selected networks.
Add a firewall rule to allow specific public internet IP addresses to access the Azure SQL Database. Click + Add a firewall rule then enter the start and end IPv4 address range values.
Click Save to update the server firewall rules.
Now, connect to Azure SQL Database in SSMS, and the connection goes through.
Select serverproperty('ProductVersion') as version, serverproperty('Edition') as edition
Track and Manage the Free Monthly vCore Seconds
As we specified earlier, Azure offers 100,000 vCore seconds per month. Therefore, you must track and manage the resources effectively to utilize them for that period. Azure SQL Database serverless configuration automatically pauses the database when no open connections exist. Therefore, you can run the following query, check the connected sessions, and disconnect them when unused. Disconnecting the database connections from tools such as Azure Data Studio (ADS), SSMS, and Visual Studio is essential.
SELECT session_id, host_name, program_name, client_interface_name, login_name, status, login_time, last_request_start_time, last_request_end_time FROM sys.dm_exec_sessions AS s INNER JOIN sys.dm_resource_governor_workload_groups AS wg ON s.group_id = wg.group_id WHERE s.session_id <> @@SPID AND ( ( wg.name like 'UserPrimaryGroup.DB%' AND TRY_CAST(RIGHT(wg.name, LEN(wg.name) - LEN('UserPrimaryGroup.DB') - 2) AS int) = DB_ID() ) OR wg.name = 'DACGroup' );
Also, once you log into the Azure portal, you can check the overview of the Azure SQL Database and see the remaining vCore seconds. As shown below, currently, I have 98.198 vCore seconds remaining. The status column also shows that the database is currently in a paused state.
If you want to check whether you are using the Azure SQL Database free offer, click on the feature tab, which shows that the offer is active.
Next Steps
- Deploy and start exploring the Azure SQL Database for free.
- You can review existing tips for Azure.
- Read FAQ for Azure SQL Database free for any questions.
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips
Article Last Updated: 2024-07-31