Hello folks, today we’ll setup custom port to access our SQL Server remotely. The steps are as below.

1. Setting up the Security Groups

  • A security group acts as a virtual firewall, controlling the traffic that is allowed to reach and leave the resources that it is associated with.
  • Adding the default TCP port 1433 to access SQL Server.
  • Now we will add the custom TCP port from which we need to access the SQL server. (I’ve added it as 4999)
  • You can add other ports as well according to your use case.
  • You can set the source as My IP address to access the SQL Server or RDP instance. It will make it more secure.

2. SQL Server Configuration

  • Verify that your SQL Server is connecting locally and remotely.
  • To connect your SQL Server remotely you need to go your SQL Server’s properties by clicking right click on the server’s name.
  • Then go to the connections on the left side of the dialog box.
  • Then you need to allow the connection from this server by checking in the check box.
  • This will allow to connect your SQL Sever remotely.
  • Thereafter you need to go in the security tab from the dialog box and select SQL Server and windows authentication mode to connect your SQL Server with user credentials.
  • After doing this exercise you can login the remotely server with your DB user.

3. Changing the default TCP port (1433) to custom TCP port

  • Open your SQL Sever Configuration Manager.
  • Select SQL Server Network Configuration >> Protocol for MSSQL Server >> TCP/IP.
  • Then right click on the TCP/IP and select properties. Then click on IP Address from the header of the dialog box.
  • Here you will get the default port SQL Server TCP port 1433. You can change it to the custom port of your choice. Make sure that you have added that port in the Security groups of your SQL Server Instance.
  •  You can make the changes according to your use case. If you want to connect SQL Server with your private IP then you have to change the default TCP port(1433) to the custom TCP port(4999).
  • You can change the public IP’s TCP port if you want to access it using custom port.

4. Allowing custom port(4999) in Windows Firewall

  • You need to allow the custom TCP port (4999) by adding new inbound rule in your internal firewall to access SQL Server. It can be your Windows firewall or 3rd party Antivirus whatever that you’re using in SQL Server.
  • Now the custom port is ready to use.
  • SQL Server is connected with custom TCP Port


Thank you!!!

Similar Posts

Leave a Reply

Your email address will not be published.