Use Azure SQL Database for free
Table of Contents
Introduction
A free tier has been quietly added to Azure SQL Database. 1
Deploy Azure SQL Database for free
Try Azure SQL Database at no cost with our free tier offer. Each Azure subscription allows you to create up to 10 General Purpose databases. For each database, you receive a monthly allowance of 100,000 vCore seconds of compute, 32 GB of data storage, and 32 GB of backup storage, free for the lifetime of your subscription.
"100,000 vCore seconds" is approximately 27 hours in a simple calculation. If you use a serverless configuration, the database does not consume core hours while paused, making it ideal for trials, technical verification, and learning. 32 GB of storage is also ample for prototype development.
Let's quickly create a SQL Database on the free tier.
Create a SQL Database
1Start SQL database creation
From the Azure portal, click Azure SQL
> Azure SQL Database
's Try for free
(Figure 1).
Figure 1. Try Azure SQL Database for free
Free database offer applied! You got first 100,000 vCore seconds and 32GB of data & 32GB of backup storage free per month for lifetime of the subscription.
This message indicates that you have selected the free tier (Figure 2).
Click "New" for the server (Figure 3). If a SQL Database server already exists, you can choose an existing server. In that case, proceed to step 3.
2Create a server
Let's briefly organize the differences between "SQL Database" and "SQL (Database) Server".
Item | SQL Database | SQL Server (Logical Server) |
---|---|---|
Resource Unit | A single database | A unit that groups multiple databases |
Billed | Billed (vCore, storage, etc.) | Not billed |
Managed | Scaling, backup, etc. | Authentication, firewall |
The image is that databases are under a server. This is similar to the relationship between an on-premise database server and databases. Authentication is set per server, so different authentication methods cannot be used for each database. Also, firewall configuration is per server.
Figure 4. Create Database Server
- Server name: Required
- Location (Region): Required
- Authentication method: Select any authentication method.
Here, "SQL authentication" is selected.
Click the "OK" button to complete server creation. You will automatically return to the database creation screen.
3Create a database
Figure 5. Execute database creation
Enter the required fields (Figure 5).
- Resource group: Required
- Database name: Required
- Server: The server created in step 2, or an existing SQL server
Behavior when free offer limit reached
Select the behavior when the free offer limit is reached.Auto-pause the database until next month
: Automatically pauseContinue using database for additional charges
: Continue operation (will incur charges)
The Behavior when free offer limit reached
setting can be changed after database creation, so you may create it with Auto-pause
for now.
Click "Review + create" to confirm database creation.
4Database creation completed
When you check the deployed database, "Free" is displayed in the pricing plan (Figure 6).
5Allow public access
This step is not mandatory, but let's configure it so you can connect from your local PC.
On the server, navigate to Settings
> Networking
> Public access
tab and select "Selected networks" (Figure 7).
Click "+ Add client IPv4 address (xxx.xxx.xxx.xxx)" to add a row, then click "Save" (Figure 8).
Figure 8. Add client IPv4 address
The IP address added here will be your current global IP address. While this configures access only from your global IP address, most people do not have a fixed IP address. If your IP address changes, you will need to perform "Add client IPv4 address" again (you'll notice immediately due to connection errors). If you add a new IP address, it's a good idea to delete the old one.
Let's try connecting from a local PC. Here, we will use SSMS (SQL Server Management Studio) (Figure 9).
Figure 9. Enter connection information
Enter the connection information as follows:
- Server Name:
Server name created in step 2
+.database.windows.net
- User Name:
User name registered in step 2
- Password:
Password registered in step 2
- Database Name:
Database name created in step 3
Click the "Connect" button to connect. Since only the database was created, there are no tables (Figure 10).
Access SQL Database from a Program
For C#
Let's create a table in the SQL Database we created using the "Code-first with minimal configuration" procedure from Entity Framework Core with Code-First.
The connection string can be copied from SQL Database > Settings
> Connection strings
> ADO.NET (SQL authentication)
.
To make it more interesting than just creating a table, I added code to register a record (lines 3 to 5).
using Microsoft.EntityFrameworkCore;
var context = new AppDbContext();
context.Hoge.Add(new Hoge { Name = "hoge" });
context.SaveChanges();
public class AppDbContext : DbContext
{
public DbSet<Hoge> Hoge { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlServer("<connection string>");
}
public record Hoge
{
public int Id { get; set; }
public string Name { get; set; }
}
After Add-Migration
> Update-Database
> program execution, data was registered (Figure 11).
For Python
Install pymssql
to connect to SQL Server.
pip install pymssql
import pymssql
conn = pymssql.connect(
server='<server name>.database.windows.net',
user='<username>',
password='<password>',
database='<database name>'
)
cursor = conn.cursor()
cursor.execute('SELECT * FROM Hoge')
for row in cursor:
print(row)
conn.close()
The registered data was displayed.
> python hoge.py
(1, 'hoge')
References
Deploy Azure SQL Database for free
Footnotes
-
It seems to have been added in February 2025.
Generally Available: Azure SQL Database free offer↩