Quickstart: Create a single database in Azure SQL Database using the Azure portal, PowerShell, and Azure CLI

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 compute tier.

  • A single database in the provisioned compute tier is pre-allocated a fixed amount of compute resources including CPU and memory using one of two purchasing models.
  • A single database in the serverless compute tier has a range of compute resources including CPU and memory that are auto-scaled and is only available in the vCore-based purchasing models.

When you create a single database, you also define a SQL Database server to manage it and place it within Azure resource group in a specified region.

Note

This quickstart uses the vCore-based purchasing model, but the DTU-based purchasing model is also available.

To create a single database containing the AdventureWorksLT sample data:

In this step, you will create an Azure SQL Database single database.

Important

Be sure to set up firewall rules to use the public IP address of the computer you're using to complete this article.

For information, see Create a database-level firewall rule or to determine the IP address used for the server-level firewall rule for your computer see Create a server-level firewall.

Create your resource group and single database using the Azure portal.

  1. Select Azure SQL in the left-hand menu of the Azure portal. If Azure SQL is not in the list, select All services, then type Azure SQL in the search box. (Optional) Select the star next to Azure SQL to favorite it and add it as an item in the left-hand navigation.

  2. Select + Add to open the Select SQL deployment option page. You can view additional information about the different databases by selecting Show details on the Databases tile.

  3. Select Create:

    Create single database

  4. 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.

      New SQL database - basic tab

  5. In the Database Details section, type or select the following values:

    • Database name: Enter mySampleDatabase.

    • Server: Select Create new, enter the following values and then select Select.

      • Server name: Type mysqlserver; along with some numbers for uniqueness.

      • Server admin login: Type azureuser.

      • Password: Type a complex password that meets password requirements.

      • Location: Choose a location from the drop-down, such as West US.

        New server

      Important

      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.

      SQL Database details

    • Select Provisioned.

      Provisioned Gen4

    • Review the settings for vCores, and Data max size. Change these as desired.

      • Optionally, you can also select Change configuration to change the hardware generation.
    • Select Apply.

  6. Select the Additional settings tab.

  7. In the Data source section, under Use existing data, select Sample.

    Additional SQL DB settings

    Important

    Make sure to select the Sample (AdventureWorksLT) data so you can follow easily this and other Azure SQL Database quickstarts that use this data.

  8. Leave the rest of the values as default and select Review + Create at the bottom of the form.

  9. Review the final settings and select Create.

  10. 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.

  1. On the SQL Database page for your database, select Query editor (preview) in the left menu.

    Sign in to Query editor

  2. Enter your login information, and select OK.

  3. 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;
    
  4. Select Run, and then review the query results in the Results pane.

    Query editor results

  5. 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:

  1. From the left menu in the Azure portal, select Resource groups, and then select myResourceGroup.
  2. On your resource group page, select Delete resource group.
  3. Enter myResourceGroup in the field, and then select Delete.

Next steps