Connect To Azure SQL From SSMS

This Azure SQL tutorial will discuss the quick steps to connect to Azure SQL database from SSMS.

How to connect to Azure SQL database from SSMS

Let’s discuss how to use SQL Server Management Studio to connect and query the Azure SQL database.

Before we start, Below are a few things we need as prerequisites

  • An Azure SQL Database, if you don’t have created one yet, create an Azure SQL Database now.
  • SQL Server Management Studio needs to be installed on your machine.

Follow the below steps to connect and access the Azure SQL Database

1. Log in to Azure Portal (https://portal.azure.com/)

2. Search for the SQL databases and click on the same search result.

Connect To Azure SQL Database

3. You will find the list of databases you created. Click on the one you want to connect to the SQL Server Management Studio.

connect to azure SQL database

4. Once you click on the database you want to connect, you will find all the information like status, Resource group, Location, Subscription, server name, etc. related to that database.

Use SQL Server Management Studio To Connect Azure SQL Database

Now copy the Server name from the above page and keep it in a notepad that we need to connect from the SQL Server Management Studio.

Now, the next step is to Open the SQL Server Management Studio.

Connect to azure sql database using SQL Server Management Studio

Now, enter the server name that you copied following the above steps and kept in a notepad, select SQL Server Authentication mode, enter the credentials, and click on ‘Connect’.

how to connect sql database in azure

You need to set your firewall rule in Azure Portal. If you have not done it, it will show you the below message, so we need to set the firewall rule.

how to connect to azure sql database from ssms

Now, to set the firewall rule, navigate to your Azure SQL Database again, and click the Set server firewall button from the top of the Overview tab.

connect to azure sql server from local ssms

On the Firewall settings, set the Allow Azure services and resources to access this server option to Yes and then click on the + Add client IP button and next click on the Save button to save the changes.

Use SSMS To Connect Azure SQL Database

Now you can see below I successfully updated the server firewall rules.

how to connect local sql server to azure using Azure Portal

Now, from the SQL Server Management Studio, enter the credentials and click the ‘Connect‘ button to connect to the Azure SQL database from the local SQL Server Management Studio.

how to connect sql database in azure

Now you can see below we have connected to the Azure SQL Database successfully from the local SQL server management studio without any issues.

connect to azure sql database from ssms

Query data

Now we are connected to the Azure SQL Database, let’s try to query the data

Let’s create a table in the database first using the below SQL Script

CREATE TABLE MYINFO
(
LastName varchar(255),
FirstName varchar(255),
);
Connect To Azure SQL Database From On-premise

Now you can see below the table has been created successfully without any issue

how to connect to azure sql database from local sql server management studio

You may also like following the articles below

Conclusion

This Azure SQL tutorial discussed the quick steps to connect to Azure SQL from SSMS. Thanks for reading this article !!!