Quickstart: Deploy a Sample Database to Azure SQL Database
This guide provides a step-by-step process to quickly deploy a sample database to Azure SQL Database. This is a great way to get started with Azure SQL Database and explore its capabilities.
Deploy a fully functional sample database in minutes!
Prerequisites
An Azure account with an active subscription. If you don't have one, you can create a free account.
The Azure CLI installed on your machine or use Azure Cloud Shell.
Steps to Deploy
Step 1: Sign in to your Azure Account
Open your terminal or command prompt and run the following Azure CLI command to sign in:
az login
This will open a browser window for you to authenticate with your Azure credentials.
Step 2: Create an Azure SQL Server and Database
We'll create a resource group, a logical SQL server, and then deploy the sample AdventureWorksLT database. Replace <your-server-name> with a unique name for your SQL server.
Make sure <your-server-name> is globally unique. It can contain letters, numbers, and hyphens.
Run the following commands:
1.az group create --name AdventureWorksResourceGroup --location eastus
This command deploys the AdventureWorksLT database, which is a small online transaction processing (OLTP) sample database.
Step 3: Configure Firewall Rules
To connect to your SQL server, you need to allow your IP address through the firewall. You can either manually add your current IP address or allow all Azure services and resources to access the server (not recommended for production).
Option A: Allow your current IP address
First, find your public IP address. Then, run the following command, replacing <your-server-name> and <your-ip-address>:
az sql server firewall-rule create --server <your-server-name> --resource-group AdventureWorksResourceGroup --name AllowMyIP --start-ip-address <your-ip-address> --end-ip-address <your-ip-address>