Provisioning a MS SQL Database Instance in Azure

1 hour
  • 2 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will practice provisioning an Azure SQL Database (SQL DB) instance two ways. First, we will provision a SQL DB instance using the Azure Portal. Next, we will provision an instance using PowerShell.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a SQL Database Instance Using the Azure Portal

Create a SQL Database

  1. Navigate to the "SQL databases" page of the Azure Portal.
  2. Click Create sql database.
  3. Configure the following settings:
    • Location: East US
    • Use SQL elastic pool: No
    • Database tier: Standard
    • DTUs: 10
    • Data max size: 50 GB
    • Data source: Sample

Configure Geo-Replication

  1. Navigate to the SQL database we just created.
  2. Under Settings, click Geo-Replication.
  3. Under TARGET REGIONS, select West US.
  4. In the Create secondary menu, click Target server.
  5. Create and configure a new server.
  6. Click Select, then OK.

Encrypt Data at Rest

  1. Under Security, click Transparent data encryption.
  2. Under Data encryption, select ON.

Enable Dynamic Data Masking

  1. Under Security, click Dynamic Data Masking.
  2. Add a new masking rule with the following settings:
    • Schema: SalesLT
    • Table: Customer
    • Column: EmailAddress (nvarchar)
    • Masking field format: Email (
  3. Click Add.
  4. Click Save.
Create a SQL Database Instance Using PowerShell

Create a SQL Server

  1. From the Azure dashboard, click the Cloud Shell icon at the top of the page.
  2. Click PowerShell.
  3. Under Subscription, click Show advanced settings.
  4. Select the same region as your lab provided Resource Group. Under Storage account, select Create new, and enter a unique name in the field below.
  5. Under File Share, select Create new, and enter a unique name in the field below.
  6. Click Create storage.
  7. In the PowerShell terminal window, run the following command to check the Azure subscription:
  8. Run the following command to check the Azure subscription:
  9. Check the resource group and its current location.
  10. Create a new SQL server.
  11. At the ServerName prompt, enter a unique name (e.g., test1990235).
  12. At the User prompt, enter a unique name (e.g., admin1990235).
  13. At the Password prompt, enter a unique password (e.g., Test123456).
  14. At the Location prompt, enter southcentralus.
  15. At the ResourceGroupName prompt, enter the resource group name (found in the output of the Get-AzResourceGroup cmdlet).

Create a SQL Database

  1. Run the following command:
    New-AzSqlDatabase ` -DatabaseName [DATABASE_NAME] ` -MaxSizeBytes 53687091200 ` -Edition "Standard" -ResourceGroupName [RESOURCE_GROUP_NAME] -RequestedServiceObjectiveName S0
  2. At the ServerName prompt, enter the server name.

Note: Some PowerShell commands take a while to run. If you don’t immediately see an output, be patient and wait for PowerShell to finish executing the query (could take 5-15 minutes).

Additional Resources

Log in to the live environment with the provided credentials.

Create a single-instance SQL database with the following characteristics:

  • Geo-replication in West US
  • 10 DTUs and 50 GB size
  • Encrypted data at rest
  • Dynamic data masking for customer email addresses
  • East US region (Azure Portal) | South Central US region (PowerShell)

Useful PowerShell cmdlets:

  • Get-AzSubscription
  • Get-AzResourceGroup
  • Get-AzSqlServer
  • Get-AzSqlDatabase

Helpful Microsoft docs:

For detailed instructions on how to complete these tasks, expand each learning objective below, or click the Guide tab above the video player.

Note: When setting up the Azure Cloud Shell, use the same region as your lab provided resource group.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?