Quickstart: Create an Azure SQL database in the Azure portal

Azure SQL Database is a Database-as-a-Service that lets you run and scale highly available SQL Server databases in the cloud. This quickstart shows you how to get started by creating and then querying an Azure SQL 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 SQL database

An Azure SQL database has a defined set of compute and storage resources. You create the database in an Azure SQL Database logical server within an Azure resource group.

To create a SQL database containing the AdventureWorksLT sample data:

  1. Select Create a resource in the upper left-hand corner of the Azure portal.

  2. Select Databases and then select SQL Database.

  3. In the Create SQL Database form, type or select the following values:

    • Database name: Enter mySampleDatabase.
    • Subscription: Drop down and select the correct subscription, if it doesn't appear.
    • Resource group: Select Create new, type myResourceGroup, and select OK.
    • Select source: Drop down and select Sample (AdventureWorksLT).

      Important

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

    Create Azure SQL database

  4. Under Server, select Create new.

  5. In the New server form, type or select the following values:

    • Server name: Enter mysqlserver.
    • Server admin login: Type azureuser.
    • Password: Enter Azure1234567.
    • Confirm Password: Retype the password.
    • Location: Drop down and select any valid location.

    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.

    Create server

  6. Choose Select.

  7. On the SQL Database form, select Pricing tier. Explore the amount of DTUs and storage available for each service tier.

    Note

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

    Note

    More than 1 TB of storage in the Premium tier is currently available in all regions except: UK North, West Central US, UK South2, China East, USDoDCentral, Germany Central, USDoDEast, US Gov Southwest, US Gov South Central, Germany Northeast, China North, and US Gov East. In these regions, the storage max in the Premium tier is limited to 1 TB. For more information, see P11-P15 current limitations.

  8. For this quickstart, select the Standard service tier, and then use the slider to select 10 DTUs (S0) and 1 GB of storage.

  9. Select Apply.

    Select pricing

  10. On the SQL Database form, select Create to deploy and provision the resource group, server, and database.

    Deployment takes a few minutes. You can select Notifications on the toolbar to monitor deployment progress.

    Notification

Query the SQL database

Now that you've created an Azure SQL 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, SQL server, and SQL 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