Thursday, September 16, 2021

Create an Azure SQL Database

 Tailwind Traders has chosen Azure SQL Database for part of its migration. You've been tasked with creating the database.

In this exercise, you'll create a SQL database in Azure and then query the data in that database.

Task 1: Create the database

In this task, you create a SQL database based on the AdventureWorksLT sample database.

Task 1: Create the database

In this task, you create a SQL database based on the AdventureWorksLT sample database.

1. Sign in to the Azure portal.

2. Select Create a resource > Databases > SQL database.

3. On the Basics tab, fill in the following information:

Setting

Value

Subscription

Choose Concierge Subscription

Resource Group

Choose [sandbox resource group name]

Database name

db1

4. For the Server, select Create new. i.  Enter the following information (replace nnnn in the name of the server with letters and digits, such that the name is globally unique)

Setting

Value

Server Name

sqlservernnn (must be unique)

Server admin login

sqluser

Password

Pa\(w0rd1234

Location

(US) East US

Create SQL Database settings for Basics with create new server pane on the right highlighted

ii. Select OK when you have finished.

5. Select the Next: Networking > at the bottom, and configure the following settings (leave others with their defaults):

Setting

Value

Server Name

sqlservernnn (must be unique)

Server admin login

sqluser

Password

Pa\)w0rd1234

Location

(US) East US

6. Select the Next: Networking > at the bottom, and configure the following settings (leave others with their defaults):

Setting

Value

Connectivity Method

Public Endpoint (Default)

Create SQL Database settings focused on Additional settings section

7. Select Review + create > Create to deploy the server and database. i. It can take approximately 2 to 5 minutes to create the server and deploy the sample database.

8. Select Go to resource.

9. Select Set server firewall and Allow Azure services and resources to access this server = Yes.

10. Select Save.

11. Select OK.

Task 2: Test the database

In this task, you configure the server and run a SQL query.

1. From the All resources pan, search and select SQL databases and ensure that your new database was created. You might need to refresh the page.

SQL databases dashboard containing table with one database called db1

2. Select the db1 entry representing the SQL database you created, and then select Query editor (preview) on the left side

3. Sign in as sqluser, with the password Pa\(w0rd1234.

4. You will not be able to sign in. Read the error closely and make note of the IP address that needs to be allowed through the firewall.

SQL Database Query Editor login screen with error code underneath password input

5. Select Overview > Set server firewall.

6. In Client IP address your IP will be shown, create a Rule name > Add your IP in both Start IP and END IP and then select Save.

Azure sqlservices - Firewalls and virtual networks dashboard with add client IP button highlighted

7. Return to your SQL database and the Query Editor sign-in page. Try to sign in again as sqluser, with the password Pa\)w0rd1234. This time you should succeed. It might take a couple of minutes for the new firewall rule to be deployed. If you wait and still get an error, try selecting Firewall settings > again.

8. After you sign in successfully, the query pane appears. Enter the following query into the editor pane:

9. Select Run, and then review the query results in the Results pane. The query should run successfully.

SQL query editor showing sql query with a join on two tables. The query success message at the bottom left is highlighted

Congratulations! You've created a SQL database in Azure and successfully queried the data in that database.

No comments:

Post a Comment