Quickstart: Create a single database in Azure SQL Database using the Azure portal
Creating a single database is the quickest and simplest deployment option for creating a database in Azure SQL Database. This quickstart shows you how to create and then query a single database using the Azure portal.
If you don't have an Azure subscription, create a free account.
For all steps in this quickstart, sign in to the Azure portal.
Create a single database
A single database can either be created in the provisioned or serverless (preview) compute tier.
- A single database in the provisioned compute tier has a defined amount of pre-allocated compute resources plus a set of memory and storage resources using one of two purchasing models.
- A single database in the serverless compute tier has a range of compute resources that are auto-scaled plus a specified amount of memory per core, and a specified amount of storage resources and is only available in the vCore-based purchasing models.
To create a single database containing the AdventureWorksLT sample data:
Select Create a resource in the upper left-hand corner of the Azure portal.
Select Databases and then select SQL Database to open the Create SQL Database page.
On the Basics tab, in the Project Details section, type or select the following values:
Subscription: Drop down and select the correct subscription, if it doesn't appear.
Resource group: Select Create new, type
myResourceGroup, and select OK.
In the Database Details section, type or select the following values:
Database name: Enter
Server: Select Create new and enter the following values and then select Select.
Server name: Type
mysqlserver; along with some numbers for uniqueness.
Server admin login: Type
Password: Type a complex password that meets password requirements.
Location: Choose a location from the drop-down, such as
West US 2.
Remember to record the server admin login and password so you can log in to the server and databases for this and other quickstarts. If you forget your login or password, you can get the login name or reset the password on the SQL server page. To open the SQL server page, select the server name on the database Overview page after database creation.
Want to use SQL elastic pool: Select the No option.
Compute + storage: Select Configure database and for this quickstart, select vCore-based purchasing options
Review the settings for Max vCores, Min vCores, Auto-pause delay, and Data max size. Change these as desired.
Accept the preview terms and click OK.
Select the Additional settings tab.
In the Data source section, under Use existing data, select
Make sure to select the Sample (AdventureWorksLT) data so you can follow easily this and other Azure SQL Database quickstarts that use this data.
Leave the rest of the values as default and select Review + Create at the bottom of the form.
Review the final settings and select Create.
On the SQL Database form, select Create to deploy and provision the resource group, server, and database.
Query the database
Now that you've created the database, use the built-in query tool in the Azure portal to connect to the database and query the data.
On the SQL Database page for your database, select Query editor (preview) in the left menu.
Enter your login information, and select OK.
Enter 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;
Select Run, and then review the query results in the Results pane.
Close the Query editor page, and select OK when prompted to discard your unsaved edits.
Clean up resources
Keep this resource group, database server, and single database if you want to go to the Next steps. The next steps show you how to connect and query your database using different methods.
When you're finished using these resources, you can delete them as follows:
- From the left menu in the Azure portal, select Resource groups, and then select myResourceGroup.
- On your resource group page, select Delete resource group.
- Enter myResourceGroup in the field, and then select Delete.
- Create a server-level firewall rule to connect to the single database from on-premises or remote tools. For more information, see Create a server-level firewall rule.
- After you create a server-level firewall rule, connect and query your database using several different tools and languages.
- To create a single database in the provisioned compute tier using Azure CLI, see Azure CLI samples.
- To create a single database in the provisioned compute tier using Azure PowerShell, see Azure PowerShell samples.
- To create a single database in the serverless compute tier using Azure Powershell, see Create serverless database.