Connect to SQL Server Express over a Restricted TCP Endpoint
A successful local connection does not establish that SQL Server accepts TCP connections from another computer. Local clients can use shared memory. Work through the listener, network path and login separately so that a login problem does not lead to unnecessary firewall changes.
Verify the Instance Locally
On the server, confirm that the intended SQL Server (instance) service is running in SQL Server Configuration Manager. Connect locally with an authorized account:
sqlcmd -S '.\SQLEXPRESS' -E -d master -Q "SELECT @@SERVERNAME AS ServerName;"
This should return the intended instance. If it fails, fix the service, instance name or authentication before changing remote access.
Configure Only the Intended Listener
In SQL Server Network Configuration, select Protocols for the intended instance and enable TCP/IP. Open its properties and choose an available fixed TCP port, such as 51433 for this example. Clear the corresponding TCP Dynamic Ports value rather than leaving 0, which requests a dynamic port.
If Listen All is enabled, port settings under IPAll apply. If you need to limit listening interfaces, set Listen All to No and configure only the intended addresses. Do not enable every adapter indiscriminately. Restart the Database Engine during an appropriate maintenance window and confirm the listening address and port in its error log.
Permit the Specific Network Path
Have the server's firewall allow inbound TCP to the chosen port only from the approved client addresses or subnet and appropriate network profile. Apply the same restriction at intervening network controls. Do not disable the firewall or expose the listener directly to the public internet.
A fixed-port client does not require SQL Server Browser. If named-instance discovery is actually required, Browser uses UDP 1434 in addition to the instance's TCP port. Keep that discovery access scoped as well.
Test the Endpoint from the Client
Replace the example host and port with the configured endpoint:
Test-NetConnection -ComputerName 'db.example.internal' -Port 51433
sqlcmd -S 'tcp:db.example.internal,51433' -E -d master -Q "SELECT @@SERVERNAME AS ServerName, DB_NAME() AS DatabaseName;"
TcpTestSucceeded = True establishes a TCP connection, not successful SQL authentication. The second command should return the expected server and master. Windows authentication also requires an identity the server recognizes. Configure trusted encryption and correct certificate names for the connection.
Interpret the Failure
| Observation | Investigate next |
| Local connection fails | Instance name, service state, login and database access |
| Local TCP works but remote TCP test fails | Listener interface, routing and scoped firewall rules |
Explicit port works but server\instance fails |
Instance discovery and SQL Server Browser |
| Login failure after reaching the server | Authentication, login state and database permissions |
| Certificate validation fails | Trust chain, expiry and host name |
The remote admin connections setting controls the dedicated administrator connection. It is not the switch for ordinary remote application connections and should not be enabled as a connection workaround. Named Pipes and SQL authentication are also unnecessary if the intended solution uses TCP and Windows authentication.
Microsoft References
-
Configure a specific TCP port
-
TCP/IP address settings
-
Configure the Windows firewall
-
SQL Server Browser
-
Troubleshoot connection errors
Author: Herman Schoenfeld