Microsoft Azure - Connect to SQL Server on VM over Internet

In this article, let us see steps to connect to SQL Server on VM over Internet.

Below are the three steps to connect to SQL Server on VM over Internet :

1) In Azure portal - Under VIRTUAL MACHINES - Create an ENDPOINT
2) In VM - Create SQL Server login and enable SQL Server Authentication mode
3) In VM - Windows Firewall with Advanced Security - Add a New Inbound rule to enable Port




1) In Azure portal - Under VIRTUAL MACHINES - Create an ENDPOINT


Click on your Virtual Machine Name 



Goto ENDPOINTS and click on ADD icon in the bottom








Next, Provide Endpoint Name and Public Port = 57500 , Private Port = 1433



Note: select different port numbers to avoid malicious security attacks

2) In VM - Create SQL Server login and enable SQL Server Authentication mode


i)  Open SSMS on VM -> Under Object Explorer -> right-click on Server -> Properties -> Security -> Enable SQL Server and Windows Authentication mode

ii)  Under Object Explorer ->  Security -> Create a Login with Server role - Sysadmin

3) In VM - Windows Firewall with Advanced Security - Add a New Inbound rule to enable Port

In VM, Start - > Search WF.msc - > Windows Firewall with Advanced Security

Create New Inbound Rule as shown below:






Next provide Name and description and click Finish.

Now this is how I connected to SQL Server VM instance from some other computer over internet

Server=VMname.cloudapp.net,57500 and With the login created in above step



See Also:


No comments: