Azure SQL Server - Complete Tutorial for Beginners
Azure SQL Server refers to Microsoft's family of relational database services built on the SQL Server engine and hosted on Azure. It lets you run fully managed databases in the cloud without worrying about patching, backups, or hardware maintenance, so teams can focus on application logic instead of database administration.
Deployment Options
- Azure SQL Database — a fully managed, single-database or elastic pool PaaS offering
- Azure SQL Managed Instance — near-complete SQL Server compatibility with managed infrastructure
- SQL Server on Azure VMs — full control over the OS and SQL Server instance, IaaS style
Key Features
- Automatic backups and point-in-time restore
- Built-in high availability with automatic failover
- Advanced threat protection and auditing
- Elastic scaling of compute and storage independently
- Intelligent performance tuning recommendations
Getting Started
- Create a logical SQL server from the Azure Portal
- Provision a database and configure firewall rules
- Connect using SQL Server Management Studio (SSMS) or Azure Data Studio
- Choose a pricing tier (DTU-based or vCore-based) that matches your workload
Ready to master Microsoft Azure?
Join Microsoft Azure Training Course at Uncodemy and learn with hands-on projects and mentor support.
Provisioning a Database With the Azure CLI
The Portal steps listed above can also be scripted. A script documents exactly what was created and lets you rebuild the same setup in another environment. The logical server name must be globally unique, because it becomes yourname.database.windows.net.
az group create --name rg-sql-demo --location centralindia
# Logical server with Microsoft Entra admin (no SQL password needed)
az sql server create \
--name sql-demo-app01 \
--resource-group rg-sql-demo \
--location centralindia \
--enable-ad-only-auth \
--external-admin-principal-type User \
--external-admin-name you@yourdomain.com \
--external-admin-sid <your-object-id>
# Serverless General Purpose database
az sql db create \
--name appdb \
--resource-group rg-sql-demo \
--server sql-demo-app01 \
--edition GeneralPurpose \
--family Gen5 \
--capacity 2 \
--compute-model Serverless
# Allow only your current public IP
az sql server firewall-rule create \
--resource-group rg-sql-demo \
--server sql-demo-app01 \
--name my-laptop \
--start-ip-address <your-ip> \
--end-ip-address <your-ip>
After that, connect from SSMS or Azure Data Studio using the server name, choose Microsoft Entra authentication, and select appdb as the database.
DTU, vCore and Serverless Explained Simply
The DTU model bundles CPU, memory and I/O into a single measure, which is easy to start with but hard to fine-tune. The vCore model lets you choose compute and storage separately and maps more directly to on-premises hardware, which helps when sizing a migration. Within vCore, the serverless option scales compute automatically and can pause an idle database, which suits development or irregular workloads. A paused database takes a short while to resume on the first connection, so it is not ideal for apps that need instant responses at all times.
Pricing changes over time and varies by region, so use the Azure pricing calculator to compare options for your actual workload.
Your First Queries in Azure SQL Database
Azure SQL Database speaks the same T-SQL you would use with SQL Server, so standard scripts work as expected:
CREATE TABLE dbo.Products
(
ProductId INT IDENTITY PRIMARY KEY,
Name NVARCHAR(100) NOT NULL,
Price DECIMAL(10,2) NOT NULL
);
INSERT INTO dbo.Products (Name, Price)
VALUES (N'Keyboard', 1299.00), (N'Mouse', 499.00);
SELECT Name, Price
FROM dbo.Products
WHERE Price > 500;
A few server-level features behave differently. In a single database you cannot use USE otherdb to switch databases, and SQL Agent jobs are not available; Managed Instance supports both, while elastic jobs or Azure automation tools fill that gap for single databases.
Security Settings and Frequent Mistakes
- Over-broad firewall rules. A rule from 0.0.0.0 to 255.255.255.255 opens the server to the whole internet. Allow specific IPs or use private endpoints.
- Misunderstanding "Allow Azure services". This setting admits traffic from any Azure customer's resources, not only yours. Prefer virtual network rules or private endpoints.
- Apps using the admin account. Create a contained database user with only the permissions the app needs, or use a managed identity.
- Secrets in connection strings. Use managed identity authentication or keep secrets in Azure Key Vault.
- Not enabling auditing and Defender for SQL. These help detect suspicious access early.
Transparent Data Encryption is enabled by default for new databases, so data at rest is already encrypted. Confirm it under the database's security settings rather than assuming.