How To Create SQL Database In Azure And Connect With SQL Server Management Studio

Creating a SQL Azure Database in Microsoft Azure is very simple. Interestingly, we can connect our SQL Azure database to the SQL Server Management Studio easily. Let's see how.

Prerequisites

  • Microsoft Azure Account
  • SQL Server Management Studio
Step 1 - Create SQL Database on Azure
 
To create a SQL database on Azure, first, we need to create an Azure account. So, let's go to the Microsoft Azure portal and create a free account. If we already have an account, then we need to log into the account.
 
The home screen is displayed after successful login.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Step 2
 
Check on the left side menu and click "SQL Databases".
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Step 3
 
The following screen will open. On the top menu, click on the "Add" button to create a new database.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 

Step 4

Now, give it a name and in the second dropdown, select your preferred subscription plan. Here, I selected "Free Trial".
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 

In the third dropdown, select a Resource group or create a new resource group by clicking on "Create new". Let's create a new resource group and click OK. 

In the next dropdown, select a database source. We created a blank database.

Now, click on "Configure required settings" and create a new server.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
  1. In the first textbox, enter the server name.
  2. Enter the login name.
  3. Add Password and Confirm Password.
  4. Select a location.
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Add the details and click "Select". The server is created.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Now, click on the "Create" button, wait for a few minutes, and click on the notification icon.
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
The database is created successfully. Now, click on "Go to source" or click on "All Resources" in the left menu bar and check demo. One database is created.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Now, click on Query editor (preview) and enter login details. In query edtior let's create a demo table and insert some values in the table
  1. create table TblDemo(Id int,Name varchar(50),City varchar(50))  
  2. insert into TblDemo values(1,'Sanwar','Jaipur')  
  3. insert into TblDemo values(1,'Demo','Demo')  

Now check the data in table,

select * from TblDemo
 
Data is inserted successfully in the table,
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
In the same way, we can create View and procedures.
 
Now, connect this SQL Azure Database to SQL Server Management Studio. Open SSMS and copy the server name from Azure Portal,

How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Add server name in SSMS and enter the Login Id and Password.
 
Click on the "Connect" button. Well, we get an error.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
To solve this error, go to the Azure portal and click on "Set server firewall" tab.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Now, click "Add client IP" and save.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 

Server firewall is updated successfully. Now, go to SSMS and click on "Connect".
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio 
 
Now, the SSMS is connected to the Azure SQL Database. Check the database and table.
 
How To Create SQL Database In Azure And Connect With SQL Server Management Studio
 
Summary
 
In this article, we learned how we create a database in the Azure Portal and connect Azure Portal to SQL Server Management Studio.