On the computer where the server instance is installed:
- Run the SQL Server Configuration Manager utility.
- Open the SQL Server node network configuration in the management tree, you will see one child node for each server instance.
- For each instance, select its node and mark whether TCP / IP is enabled (if it is not enabled, there is no port).
- Right-click the TCP / IP protocol entry and select Properties from the context menu. The TCP / IP Properties dialog box opens.
- Click the IP Address tab and scroll down to the IPAll section to view the TCP port.
If you have not configured your servers before, you are probably using dynamic ports. This is not what you want, as the port may change: it will invalidate the firewall settings. So, just clear the TCP Dynamic Ports entry and enter the current dynamic port number in the TCP port entry for IPAll. After restarting the server instance, the server will be bound to this port.
One note: if you want to refer to servers outside the firewall by instance name, you need to enable SQL Server browser through the firewall, which is UDP port 1434. In my opinion, it is better to refer to instances via the port from the outside and not worry about the SQL browser . For example, instead of MYSERVER\SQLEXPRESS in your connection string, use MYSERVER.mydomain.com,12345 (in this example, SQLEXPRESS runs on port 12345). Note that the port syntax in the connection string uses a comma separator instead of the colon separator used for http uri.
source share