I recently encountered this error while trying to connect to my Azure SQL database from the Azure Data Studio.
Table of Contents
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.

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.

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.
- Navigate to the Azure SQL database in the Azure Portal and click on the server name.

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

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

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.

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

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
