SQL Server 2012 on Azure VM – Troubleshooting Remote Connection Issues

azure-vmremotesql serversql-server-2012

I have a SQL Server 2012 instance running on a virtual machine in Azure. I have tried to connect to it using the public virtual IP address; however, I get an error saying:

The server was not found or not accessible

I have checked that the allow remote connection tickbox is checked, and have allowed the .exe through the firewall. I was wondering if it's because I need to add some endpoints to my VM instance through Azure?

Best Answer

basic things to check:

  • new firewall inbound rule inside the VM enabling sqlservr.exe. You can make it as restrictive as you want but start with allowing all inbound connections first to verify it works then lockdown one thing at a time
  • new firewall inbound rule inside the VM enabling sqlbrowser.exe. Needed if running named instance.
  • new endpoint for the Azure VM (via Azure portal) to enable SQL Server port. Some users specify some arbitrary unused port for public and SQL Server's default 1433 for private to reduce noise from port scanners that roam the internet looking for common targets. There are pros/cons to this or using default for both. You can decide what's appropriate or talk to your security folks for guidance.
  • TCP/IP enabled for SQL Server, should be enabled by default but takes 30s to verify via Configuration Manager
  • SQL Server enabled for remote access, yes another obvious one but never hurts to verify