Get Started with Azure SQL Database

Welcome to Azure SQL Database! This guide will walk you through the fundamental steps to create and interact with your first Azure SQL Database instance.

What is Azure SQL Database?

Azure SQL Database is a fully managed Platform as a Service (PaaS) database engine that handles most of the database management functions like upgrading, patching, and backups without user involvement. It's built on the SQL Server engine, providing familiar T-SQL capabilities, but in a cloud-native service.

Prerequisites

Step 1: Create an Azure SQL Server

Before you can create a SQL database, you need a logical SQL server. This server acts as a central administrative point for your databases and is where connection security and management occur.

  1. Sign in to the Azure portal.
  2. In the search bar at the top, type "SQL servers" and select "SQL servers".
  3. Click "+ Create".
  4. Fill in the required details:
    • Subscription: Select your Azure subscription.
    • Resource group: Create a new one or select an existing one.
    • Server name: Enter a globally unique name for your server (e.g., myazuresqlserver12345).
    • Location: Choose a region close to you.
    • Admin username: Create an administrator login (e.g., sqladmin).
    • Password: Create a strong password.
  5. Click "Review + create", then "Create".

Step 2: Create an Azure SQL Database

Now that you have a server, you can create a database within it. For this tutorial, we'll create a new blank database.

  1. Once your SQL server deployment is complete, navigate to the server resource.
  2. In the server overview page, click "+ Create database".
  3. Configure the database settings:
    • Database name: Enter a name for your database (e.g., mydemodb).
    • Service tier: For basic testing, the "Basic" tier is sufficient.
    • Leave other settings as default for now.
  4. Click "Review + create", then "Create".

Step 3: Connect to Your Database

You can connect to your Azure SQL Database using various tools. A common and convenient way is using Azure Data Studio or SQL Server Management Studio (SSMS).

Using Azure Data Studio

Azure Data Studio is a cross-platform database tool. Follow these steps:

  1. Download and install Azure Data Studio.
  2. Launch Azure Data Studio and click "New Connection".
  3. In the connection details:
    • Connection type: Microsoft SQL Server
    • Server: Enter your SQL server name (e.g., myazuresqlserver12345.database.windows.net).
    • Authentication type: SQL Login
    • User name: Your admin username (e.g., sqladmin).
    • Password: Your admin password.
    • Database: (Optional) You can specify mydemodb here or select it after connecting.
  4. Click "Connect".

You should now see your database listed in the Servers pane and be able to query it.

Next Steps

Congratulations on creating and connecting to your first Azure SQL Database! Here are some resources to help you continue your journey:

Next: Create a Server Programmatically