Fix: An instance-specific error occurred while establishing a connection to SQL server

I recently encountered this error while trying to connect to my Azure SQL database from the Azure Data Studio.

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

After entering all the details in the below pop-up and then I clicked on the Connect button, but all of a sudden, I got this error.

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

Below is the connection error after clicking the Connect button.

“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 in the screenshot below.

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

Solution

To fix this error, I followed the below quick steps.

Public access to my Azure SQL database was disabled by default. To enable it, I followed these 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 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 the OK button on the error pop-up. Finally, I clicked on the Connection button; this time, I got no error and could connect successfully. See the screenshot below.

How to Connect Azure Data Studio and Azure SQL database

Video Tutorial

I hope this information will help you to fix the same issue that you might encounter.

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!