When trying to connect to SQL Server on an IaaS VM server, you would get all type of weird messages when trying to  make a connection using SSMS. Yes! we can connect to SQL Server on Azure IaaS VM from the local SSMS on our machine. The easiest way to connect is the normal way which we connect :

 

You would get the name to connect from the dashboard of your VM machine :

The challenge which you would start facing is that you would be getting messages like :

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

Cannot connect to tcp:gazurevm2.cloudapp.net,1433.

------------------------------
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 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (Microsoft SQL Server, Error: 10060)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=10060&LinkId=20476

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

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

------------------------------
BUTTONS:

OK
------------------------------

 

The two settings which you have to make sure you are checking are :

1. Endpoint is configured for the port on which SQL server is listening ( generally 1433) on the VM machine.

 

2. Ports are opened on the VM machine. Even though as per the documentation Cloud adaptor takes care of opening the firewall ports, it doesn't work for the normal connections which you are trying to make. Just type in " wf.msc" and create a rule for both outgoing and incoming for TCP port 1433.

As soon as you are done with these two, you would be able to connect to the SQL server on the VM machine.

Happy Learning & Troubleshooting!!

Disclaimer:  Everything here, is my personal opinion and is not read or approved by Microsoft before it is posted. No warranties or other guarantees will be offered as to the quality of the opinions or anything else offered here.