Lesson Learned #239: Attempt was made to access a socket in a way forbidden by its access permission
Published Oct 05 2022 11:23 AM 26.5K Views

Our customer, using, for example, SQL SERVER Management Studio got the following error message:

 

TITLE: Connect to Server
------------------------------

Cannot connect to servername.database.windows.net.

------------------------------
ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - An attempt was made to access a socket in a way forbidden by its access permissions.) (Microsoft SQL Server, Error: 10013)

For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-10013-database-engine-...

------------------------------

An attempt was made to access a socket in a way forbidden by its access permissions

------------------------------

 

This error message ocurred when the application is trying to open the port 1433 as outbound to connect to the database server. If you have a firewall that is blocking the port 1433 as outbound you are going to face this error. 

 

Additionally, you might have the same issue if you have Redirect as connection policy in your Azure SQL Server. Remember that when you have configured redirect the application will try to open a port range between 11000-11999 as outbound and if your firewall is blocking this range you are going to have the same error message. 

 

We have some scenarios that our customers have only allowed the port 1433 as outbound, in this situation, you could change your Connection Policy to Proxy to use only this port. Please, see the best practices in this URL.

 

Enjoy!

Version history
Last update:
‎Oct 05 2022 11:24 AM
Updated by: