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
- Navigate to the "SQL databases" page of the Azure Portal.
- Click Create sql database.
- 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
- Navigate to the SQL database we just created.
- Under Settings, click Geo-Replication.
- Under TARGET REGIONS, select West US.
- In the Create secondary menu, click Target server.
- Create and configure a new server.
- Click Select, then OK.
Encrypt Data at Rest
- Under Security, click Transparent data encryption.
- Under Data encryption, select ON.
Enable Dynamic Data Masking
- Under Security, click Dynamic Data Masking.
- Add a new masking rule with the following settings:
- Schema: SalesLT
- Table: Customer
- Column: EmailAddress (nvarchar)
- Masking field format: Email (aXXX@XXXXX.com)
- Click Add.
- Click Save.
- Create a SQL Database Instance Using PowerShell
Create a SQL Server
- From the Azure dashboard, click the Cloud Shell icon at the top of the page.
- Click PowerShell.
- Under Subscription, click Show advanced settings.
- 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.
- Under File Share, select Create new, and enter a unique name in the field below.
- Click Create storage.
- In the PowerShell terminal window, run the following command to check the Azure subscription:
- Run the following command to check the Azure subscription:
Get-AzSubscription
- Check the resource group and its current location.
Get-AzResourceGroup
- Create a new SQL server.
New-AzSqlServer
- At the
ServerName
prompt, enter a unique name (e.g.,test1990235
). - At the
User
prompt, enter a unique name (e.g.,admin1990235
). - At the
Password
prompt, enter a unique password (e.g.,Test123456
). - At the
Location
prompt, entersouthcentralus
. - At the
ResourceGroupName
prompt, enter the resource group name (found in the output of theGet-AzResourceGroup
cmdlet).
Create a SQL Database
- Run the following command:
New-AzSqlDatabase ` -DatabaseName [DATABASE_NAME] ` -MaxSizeBytes 53687091200 ` -Edition "Standard" -ResourceGroupName [RESOURCE_GROUP_NAME] -RequestedServiceObjectiveName S0
- 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).