Quickstart: Create an Azure SQL Database

This guide will walk you through the process of creating your first Azure SQL Database using the Azure portal.

Prerequisites

Before you begin, ensure you have:

Step 1: Sign in to the Azure portal

Open your web browser and navigate to portal.azure.com. Sign in with your Azure account credentials.

Step 2: Create a SQL server

A SQL database needs a logical SQL server to host it. Follow these steps to create a new server:

1

Navigate to SQL servers

In the Azure portal search bar, type "SQL servers" and select SQL servers from the results.

2

Create a new server

Click the + Create button. This will open the "Create SQL server" blade.

3

Configure server details

Fill in the following details:

  • Subscription: Select your Azure subscription.
  • Resource group: Create a new one (e.g., myResourceGroup) or select an existing one.
  • Server name: Enter a globally unique name (e.g., yourunique-sqlserver-name).
  • Location: Choose an Azure region.
  • Administrator login: Enter a username (e.g., sqladmin).
  • Password: Enter a strong password.
  • Confirm password: Re-enter the password.
4

Review and create

Click the Review + create button, then click Create.

It may take a few minutes for the server to be provisioned.

Step 3: Create a SQL database

Now that you have a server, you can create a database on it.

1

Navigate to SQL databases

In the Azure portal search bar, type "SQL databases" and select SQL databases from the results.

2

Create a new database

Click the + Create button.

3

Configure database details

Fill in the following details:

  • Subscription: Select your Azure subscription.
  • Resource group: Select the same resource group used for your server.
  • Server: Select the server you just created from the dropdown.
  • Database name: Enter a name for your database (e.g., mySampleDatabase).
  • Compute + storage: Click Configure database to choose a service tier. For this quickstart, the Basic tier is sufficient.
4

Review and create

Click Apply on the "Configure database" blade, then click Review + create, and finally click Create.

Your database will be provisioned shortly.

Step 4: Connect to your database

Once your database is created, you can connect to it using various tools like Azure Data Studio or SQL Server Management Studio (SSMS).

Get your server name

You can find your server's fully qualified domain name (FQDN) on the SQL server's overview page in the Azure portal. It will look something like yourunique-sqlserver-name.database.windows.net.

Configure firewall rules

To connect from your local machine, you need to add your client IP address to the server's firewall rules.

1

Navigate to your SQL server

Go to your SQL server's page in the Azure portal.

2

Access Firewall settings

Under the Security section, click on Firewalls and virtual networks.

3

Add client IP

Click the Add client IP button. This will automatically detect your current public IP address and add it as a firewall rule. You can also manually enter IP addresses or ranges.

4

Save changes

Click Save.

Important Security Note

Allowing access from all Azure services and globally from your client IP is convenient for development but should be restricted in production environments. Consider using private endpoints or more specific firewall rules for enhanced security.

Next Steps

Congratulations! You have successfully created and configured your first Azure SQL Database. You can now explore various options: