Lesson Learned #256: Connection was denied since Deny Public Network Access and DNS resolution.
Published Dec 21 2022 11:48 PM 4,112 Views

Once a private link is created our customers disabled the option "Public network access" but connecting to the database they faced the following error: 'Microsoft SQL: 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. To connect to this server, use the Private Endpoint from inside your virtual network . In this article I would like to explain why this situation happened. 

 

The most tipical scenario is when the DNS server that our customer is using is resolving the public IP instead of resolving the private IP. For this reason, running a ping servername.database.windows.net is the best way to identify the IP address and check if your DNS is resolving the public or private IP. In case that is still resolving the public IP you need to contact with your networking team to review this issue.

 

In some situations, depending on Azure Service you need to configure other options to use the private IP instead of public one. 

 

Enjoy!

Version history
Last update:
‎Dec 21 2022 03:48 PM
Updated by: