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:
- An Azure account. If you don't have one, you can sign up for a free trial.
- A web browser supporting modern HTML5 and CSS3.
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.
- 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.
Step 2: Create a SQL Database
Now that you have a SQL Server, you can create a database within it.
- 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.
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.
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.
Sample T-SQL Query
SELECT @@VERSION;
This query should return information about your Azure SQL Database engine version.
Next Steps
Congratulations! You've successfully created and connected to your Azure SQL Database. Here are some resources to help you further:
- Explore tutorials for common tasks.
- Learn about performance tuning.
- Understand security features.