Quickstart: Create an Azure SQL database in the Azure portal
This quickstart walks through how to create a SQL database in Azure using the DTU-based purchasing model. Azure SQL Database is a “Database-as-a-Service” offering that enables you to run and scale highly available SQL Server databases in the cloud. This quickstart shows you how to get started by creating and then querying a SQL database using the Azure portal.
If you don't have an Azure subscription, create a free account before you begin.
This tutorial uses the DTU-based purchasing model but the vCore-based purchasing model is also available.
Log in to the Azure portal
Sign in to the Azure portal.
Create a SQL database
Follow these steps to create a SQL database containing the Adventure Works LT sample data.
Click Create a resource in the upper left-hand corner of the Azure portal.
Select Databases from the New page, and select Create under SQL Database on the New page.
Fill out the SQL Database form with the following information, as shown on the preceding image:
Setting Suggested value Description Database name mySampleDatabase For valid database names, see Database Identifiers. Subscription Your subscription For details about your subscriptions, see Subscriptions. Resource group myResourceGroup For valid resource group names, see Naming rules and restrictions. Select source Sample (AdventureWorksLT) Loads the AdventureWorksLT schema and data into your new database
You must select the sample database on this form because it is used in the remainder of this quickstart.
Under Server, click Configure required settings and fill out the SQL server (logical server) form with the following information, as shown on the following image:
Setting Suggested value Description Server name Any globally unique name For valid server names, see Naming rules and restrictions. Server admin login Any valid name For valid login names, see Database Identifiers. Password Any valid password Your password must have at least 8 characters and must contain characters from three of the following categories: upper case characters, lower case characters, numbers, and non-alphanumeric characters. Subscription Your subscription For details about your subscriptions, see Subscriptions. Resource group myResourceGroup For valid resource group names, see Naming rules and restrictions. Location Any valid location For information about regions, see Azure Regions.
The server admin login and password that you specify here are required to log in to the server and its databases later in this quickstart. Remember or record this information for later use.
When you have completed the form, click Select.
Click Pricing tier to specify the service tier, the number of DTUs, and the amount of storage. Explore the options for the amount of DTUs and storage that is available to you for each service tier.
More than 1 TB of storage in the Premium tier is currently available in all regions except the following: UK North, West Central US, UK South2, China East, USDoDCentral, Germany Central, USDoDEast, US Gov Southwest, US Gov South Central, Germany Northeast, China North, US Gov East. In other regions, the storage max in the Premium tier is limited to 1 TB. See P11-P15 Current Limitations.
For this quickstart, select the Standard service tier and then use the slider to select 10 DTUs (S0) and 1 GB of storage.
Accept the preview terms to use the Add-on Storage option.
More than 1 TB of storage in the Premium tier is currently available in all regions except the following: West Central US, China East, USDoDCentral, USGov Iowa, Germany Central, USDoDEast, US Gov Southwest, Germany Northeast, China North. In other regions, the storage max in the Premium tier is limited to 1 TB. See P11-P15 Current Limitations.
After selecting the server tier, the number of DTUs, and the amount of storage, click Apply.
Now that you have completed the SQL Database form, click Create to provision the database. Provisioning takes a few minutes.
On the toolbar, click Notifications to monitor the deployment process.
Query the SQL database
Now that you have created a sample database in Azure, let’s use the built-in query tool within the Azure portal to confirm that you can connect to the database and query the data.
On the SQL Database page for your database, click Query editor (preview) in the left-hand menu and then click Login.
Select SQL server authentication, provide the required login information, and then click OK to log in.
After you are authenticated as ServerAdmin, type the following query in the query editor pane.
SELECT TOP 20 pc.Name as CategoryName, p.name as ProductName FROM SalesLT.ProductCategory pc JOIN SalesLT.Product p ON pc.productcategoryid = p.productcategoryid;
Click Run and then review the query results in the Results pane.
Close the Query editor page, click OK to discard your unsaved edits.
Clean up resources
Save these resources if you want to go to Next steps and learn how to connect and query your database using a number of different methods. If, however, you wish to delete the resources that you created in this quickstart, use the following steps.
- From the left-hand menu in the Azure portal, click Resource groups and then click myResourceGroup.
- On your resource group page, click Delete, type myResourceGroup in the text box, and then click Delete.
- Now that you have a database, you need to create a server-level firewall rule to connect to it from your on-premises tools. See Create server-level firewall rule
- If creating a server-level firewall rule, you can connect and query using one of your favorite tools or languages, including
- To create databases using Azure CLI, see Azure CLI samples
- To create databases using Azure PowerShell, see Azure PowerShell samples