Creating An Azure SQL Database And Connecting Through SQL Server Management Studio

Introduction

This article demonstrates how to create an Azure SQL Database, set the Firewall rule, and connect through the SQL Server Management Studio.

Prerequisites

First of all, login to the Azure portal. Click here to go Azure login page.

Azure

After signing into the Azure portal, click on the SQL databases from the left panel of the website, as shown in the below image.

Azure

Now, click on "Add".

Azure

Enter the Database name. Here, we are going to give the database name as employee, Resource group name as vivek, and selecting source as a Blank database.

Azure

Now, click on the "Configure required settings for the server "

>> click on the Create a new server
>> enter the required details for Server name, Server admin login, Password, Confirm password, Choose Location
>> select the checkbox for allowing Azure service to access Server and then click on the Select button.

Here, I am giving Server name as a vivek-kumar so the Database Server name will be vivek-kumar.database.windows.net and giving Server Admin login name as vivekAdmin.

Below is the image for same.

Azure

Now, after filling all the necessary information, click on the "Create" button.

Azure

We will get notification message for "Deployments succeeded".

Azure

Now, click on "All resources" from the left panel of the website.

Azure

We will see the Server name and the database name as vivek-kumar and employee respectively.

Click on just created database employee as in the below image.

Azure

Click on the "Set server firewall" as in below image for allowing the permission from your computer.

Azure

Now, enter the rule name as per your convenience and enter the IP address of the system from where we are going to use the SQL Server Management Studio to connect the Azure SQL Database.

Here, we can also give permission for continuous series of IP address by providing the Start IP address and End IP address or we can allow only for one system by entering same IP address in the both field.

We can also see the current system’s IP address in the Firewall settings screen.

After entering the IP address details, click on the "Save" button as in the below image.

Azure

We will get success message, Click on "OK" button as in the below image.

Azure

Open the SQL Server Management Studio and enter the required information and click on the "Connect" button.

Azure

Yes, we got connected to Azure SQL DB. Now, click on the "New Query".

Azure

Now, select the employee from database dropdown menu and write SQL Query for creating the table named as Name and execute it.

  1. CREATE TABLE Name (  
  2.     PersonID int,  
  3.     FirstName varchar(100),  
  4.     LastName varchar(100)  
  5. );  

Azure

Summary

In this article, we have learned how to create an Azure SQL Database, set the firewall rule for the client system(s), and use the Azure SQL Database through SQL Server Management Studio.