(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

How to Create an Azure SQL Database: Step by Step

João Barros 06 de July de 2026 4 min read

Azure SQL Database is a fully managed relational database (PaaS): Microsoft takes care of the hardware, updates and backups, leaving you free to focus on the data. Creating your first database takes just a few minutes and is the ideal starting point for BI and analytics projects. Below you will learn how to create an Azure SQL Database in the portal, open the firewall and connect to run your first T-SQL query.

Prerequisites

  • An active Azure subscription (the free Azure account works perfectly).
  • A browser to access the Azure Portal.
  • Optional, to connect to the database: SQL Server Management Studio (SSMS) or Azure Data Studio installed on your computer.

Step 1: Open the database creation wizard

Sign in to the Azure Portal and, in the search bar at the top, type SQL databases. Click the service with that name and then the + Create button. The wizard is organized in tabs — Basics, Networking, Security and Additional settings — but for a first database you only need the first two.

Step 2: Fill in the basics

On the Basics tab, choose your subscription and create a new resource group (for example, rg-formacao-sql) to group the resources. Give the database a name, such as vendas. Next you need a logical server: click Create new, set a unique name (it becomes name.database.windows.net), pick the closest region and define the administrator user and its password. Save these credentials — you will need them to connect.

Step 3: Choose the compute tier

Still on the Basics tab, under Compute + storage, click Configure database. Azure offers two purchasing models: DTU, which bundles CPU, memory and I/O into a single simple value, and vCore, which separates them and gives more control. To learn and keep costs low, the Serverless tier (vCore model, General Purpose) is excellent: it pauses automatically when idle, so you only pay for storage during those periods. Alternatively, the Basic tier (DTU model) offers a low fixed cost. Confirm your choice to return to the wizard.

Step 4: Configure networking and the firewall

Move to the Networking tab. Under Connectivity method, choose Public endpoint. Then, in the firewall rules, set Add current client IP address to Yes. This step is crucial: without it, the server blocks the connection from your computer. You should also keep Allow Azure services and resources to access this server enabled if you plan to connect from other Azure services.

Step 5: Review and create

Click Review + create and, once validation passes, click Create. Provisioning usually takes one to two minutes. When it finishes, click Go to resource to open the database page.

Step 6: Connect and run your first query

On the database Overview page, copy the server name (it ends in .database.windows.net). Open SSMS or Azure Data Studio, choose SQL Server Authentication and enter the administrator user and password you set in Step 2. Once connected, run this T-SQL code to create a table and insert data:

CREATE TABLE dbo.Clientes (
    Id      INT IDENTITY PRIMARY KEY,
    Nome    NVARCHAR(100) NOT NULL,
    Cidade  NVARCHAR(100)
);

INSERT INTO dbo.Clientes (Nome, Cidade)
VALUES ('Ana Silva', 'Lisboa'),
       ('Joao Costa', 'Porto');

SELECT * FROM dbo.Clientes;

If you prefer to automate, you can create everything from the command line with the Azure CLI instead of the portal:

az sql server create --name meu-servidor-sql --resource-group rg-formacao-sql \
  --location westeurope --admin-user adminsql --admin-password 'UmaP@ssw0rdForte'

az sql db create --name vendas --server meu-servidor-sql \
  --resource-group rg-formacao-sql --edition GeneralPurpose --compute-model Serverless

Verify the result

There are two ways to confirm everything worked. In the Azure Portal, the database Overview page should show the status Online. And in your SQL client, the query SELECT * FROM dbo.Clientes; should return the two rows you inserted. If you get a connection error, check that your IP is in the firewall rules (Step 4) and that the password is correct.

Conclusion

You have just created a fully managed Azure SQL Database, opened the firewall and run your first query — the foundation for any cloud data project. From here you can connect Power BI directly to this database, set up geo-redundant backups or explore elastic pools to manage several databases together. What will be the first table in your next project?