Azure Data Studio Connect To SQL Server (Easy Steps)

Azure Data Studio Connect To SQL Server

In this Azure article, we will discuss how to connect to SQL server from Azure Data Studio. Along with that, we will also discuss a few other topics.

Azure Data Studio Connect To SQL Server

Before starting the actual topic, let’s discuss the prerequisites needed here.

Prerequisites

Below are the prerequisites needed here.

  1. You must have an Azure Subscription or Azure Account. If you don’t have an Azure Account, nothing to worry you can create a free Azure account now.
  2. You must download and install Azure Data Studio on your PC.
  3. Make sure to install SQL server management Studio latest version on your machine.

Assuming you are ready with all the prerequisites needed here, let’s start with the steps needed to connect to SQL server from Azure Data Studio.

  1. Launch Azure Data Studio on your PC.
  2. Click on the New dropdown –> Then click on the New connection option or, you can click on the Create a connection button.
how to connect to SQL server from Azure Data Studio

3. On the Connection window, provide the below details

  • Connection type: Choose the Connection type as Microsoft SQL server.
  • Select the Parameters radio button.
  • Server: Provide the Server name.
  • Authentication type: Choose the authentication type and the other details based on the authentication type.

Finally, click on the Connect button.

azure data studio connect to sql server windows authentication

Note: To get the server name and authentication details, open the SQL server management studio, and on the Connect to server pop-up, you will get all the details.

how to connect azure data studio connect to sql server

Now, you can able to see, we are able to connect the Azure Data Studio to the SQL server successfully without any issues.

how to connect azure data studio connect to sql server management studio

How to connect Azure Data Studio to Azure SQL

Similarly, we can connect Azure Data Studio to Azure SQL using the below steps. Check out How to create an Azure SQL database if you have not yet created your Azure SQL database.

  1. Follow step-1 and Step-2 from the above section.
  2. On the Connection window, provide the below details.
  • Connection type: Choose the connection type as SQL server.
  • Choose the Parameters option.
  • Server: Specify the server name of your Azure SQL. You will get the server name by navigating to the Azure SQL database in the Azure POrtal. Refer to the below note.
  • Authentication type: Choose SQL Login as the authentication type.
  • Username and Password: Specify the Username and password that you have specified during the creation of Azure SQL database in the Azure Portal.
  • Finally, click on the Connect button.
how to connect Azure data studio to Azure SQL

Note: Navigate to the Azure SQL database in the Azure Portal and click on the Copy to clipboard button next to the server name to copy the server name.

how to connect Azure data studio and Azure SQL

After you click on the Connect button, you might get the below connection error.

“Reason: An instance-specific error occurred while establishing a connection to SQL Server. Connection was denied since Deny Public Network Access is set to Yes (https://docs.microsoft.com/azure/azure-sql/database/connectivity-settings#deny-public-network-access). To connect to this server, use the Private Endpoint from inside your virtual network (https://docs.microsoft.com/azure/sql-database/sql-database-private-endpoint-overview#how-to-set-up-private-link-for-azure-sql-database).”

You can see it here

An instance-specific error occurred while establishing a connection to SQL Server. Connection was denied since Deny Public Network Access is set to Yes

To fix this error, you need to follow the below quick steps.

By default public access to your Azure SQL database is disabled. You need to enable it using the below steps.

  1. Navigate to the Azure SQL database in the Azure Portal and click on the server name.
Connection was denied since Deny Public Network Access is set to Yes

2. Click on the Networking link from the left navigation on the SQL Server page.

An instance-specific error occurred while establishing a connection to SQL Server

3. Select the Selected networks option for Public network access –> then click on the Save button to save the changes.

An instance-specific error occurred while establishing a connection to SQL Server.

4. Now, navigate to the Azure Data Studio, and click on the Ok button on the error pop-up. Finally, click on the Connection button, and this time you won’t get any error and will move to the next screen.

Click on the Add an Account dropdown and then click on the Add an account option.

Connect Azure Data Studio and Azure SQL

5. Login with your Azure credentials and click on the Ok button on the next pop-up.

Connection between Azure Data Studio and Azure SQL

6. Now, you can able to see we are able to connect the Azure Data Studio with Azure SQL DB successfully.

How to Connect Azure Data Studio and Azure SQL database

You may also like following the below articles

Wrapping Up

Well, in this article, we discussed how to connect Azure Data Studio to SQL server and Azure SQL database. Thanks for reading this article, Hope it helps !!!