Azure SQL Database Quickstart

Welcome to the Azure SQL Database Quickstart! This guide will walk you through the essential steps to get your first Azure SQL Database up and running in minutes.

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 such as upgrading, patching, backups, and provides 99.99% high availability. It's built on the latest stable version of Microsoft SQL Server and is compatible with SQL Server, so you can migrate your SQL Server applications to Azure without having to change them significantly.

Prerequisites

Before you begin, ensure you have:

Step 1: Create an Azure SQL Database Server

A logical SQL Server is a management construct for a group of databases. It has a single set of credentials and is used to manage databases, logins, firewall rules, and failover groups. Databases within the same logical server are located in the same Azure region.

1. Navigate to the Azure portal.
2. In the search bar, type "SQL servers" and select "SQL servers" from the results.
3. Click on the "+ Create" button.
4. Fill in the required fields:
  • Subscription: Select your Azure subscription.
  • Resource group: Choose an existing resource group or create a new one.
  • Server name: Enter a globally unique name for your server.
  • Location: Select the Azure region where you want to deploy your server.
  • Server admin login: Create a login name.
  • Password: Create a strong password.
  • Confirm password: Re-enter the password.
5. Click "Review + create" and then "Create" to deploy your server.

Step 2: Create a SQL Database

Now that you have a SQL Server, you can create a database within it.

1. Once your SQL server is deployed, navigate to its resource page.
2. In the server's menu, under "Data management", click on "Databases".
3. Click on "+ Create database".
4. Configure the database settings:
  • Database name: Provide a name for your database.
  • Compute + storage: For this quickstart, you can select a basic tier. Click "Configure" to adjust resources if needed.
  • Collation: Leave as default (SQL_Latin1_General_CP1_CI_AS) unless you have specific requirements.
5. Click "Review + create" and then "Create" to deploy your database.
For production workloads, consider different service tiers (DTU-based or vCore-based) and performance levels based on your application's needs.

Step 3: Connect to Your SQL Database

You can connect to your Azure SQL Database using various tools, including Azure Data Studio, SQL Server Management Studio (SSMS), or directly from your application code.

Note: You'll need to configure firewall rules to allow connections from your IP address.

1. On your SQL server's resource page, click "Firewalls and virtual networks".
2. Click "Add client IP" to allow your current IP address.
3. Click "Save".

Once the firewall is configured, you can use the server name, database name, and admin credentials to connect using your preferred SQL client.

Example using Azure Data Studio

If you have Azure Data Studio installed, you can connect as follows:

Connection Details
Host: <your_server_name>.database.windows.net
Authentication type: SQL Login
User name: <your_admin_login>
Password: <your_admin_password>
Database: <your_database_name>

Step 4: Run a Simple Query

Let's run a simple query to verify your connection and database functionality.

1. Open your SQL client and connect to your database.
2. Execute the following T-SQL query:
Sample T-SQL Query
SELECT @@VERSION;

This query should return information about your Azure SQL Database engine version.

For more advanced operations like creating tables, inserting data, and writing complex queries, refer to the tutorials section.

Next Steps

Congratulations! You've successfully created and connected to your Azure SQL Database. Here are some resources to help you further:

Explore Tutorials