Deploy and Manage Azure SQL Database

This tutorial guides you through the process of deploying and managing an Azure SQL Database instance. You'll learn how to create a database, configure its settings, and perform basic management tasks.

Note: This tutorial assumes you have an Azure account with an active subscription. If you don't have one, you can create a free account before you begin.

Step 1: Create an Azure SQL Database Server

Before you can create a database, you need an Azure SQL Database server. This server acts as a logical container for your databases.

  1. Sign in to the Azure portal.
  2. In the search bar at the top, type "Azure SQL" and select "Azure SQL" from the results.
  3. Click on "SQL servers" and then "+ Create".
  4. Fill in the required details:
    • Subscription: Select your active subscription.
    • Resource group: Create a new one or select an existing one.
    • Server name: Enter a globally unique name for your server.
    • Location: Choose a region close to your users.
    • Administrator login: Create a username for the server admin.
    • Password: Create a strong password.
  5. Click "Review + create" and then "Create".

Step 2: Create a SQL Database

Once your server is provisioned, you can create a new SQL database.

  1. Navigate to the SQL server you just created.
  2. Under "Data management", select "Databases" and then "+ New database".
  3. Configure the database settings:
    • Database name: Provide a name for your database.
    • Compute + storage: Select a service tier and size appropriate for your needs. For this tutorial, the Basic tier is sufficient.
    • Collation: Usually, the default is fine.
  4. Click "Review + create" and then "Create".

Step 3: Connect to Your SQL Database

After the database is deployed, you can connect to it using various tools.

We'll use Azure Data Studio for this example.

  1. Download and install Azure Data Studio.
  2. Open Azure Data Studio and create a new connection.
  3. Enter the following connection details:
    • Connection type: Microsoft SQL Server
    • Server: Your server name (e.g., your-server-name.database.windows.net)
    • Authentication type: SQL Login
    • User name: Your administrator login
    • Password: Your administrator password
  4. Click "Connect".

You should now see your database listed in the Connections pane.

Step 4: Basic Management Tasks

Firewall Rules

To allow connections from your IP address, you need to configure firewall rules.

  1. In the Azure portal, go to your Azure SQL server.
  2. Under "Security", select "Firewalls and virtual networks".
  3. Click "Add a client IP" to add your current IP address, or manually enter IP address ranges.
  4. Click "Save".

Monitoring Performance

Azure provides tools to monitor your database performance.

Backups and Restore

Azure SQL Database automatically performs backups.

Next Steps

Congratulations! You have successfully deployed and learned basic management tasks for an Azure SQL Database. Continue learning by exploring: