2

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?

3

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
1

I've just had the same problem. Hope this might help someone that cannot solve it through any other means found elsewhere:

  • I had two Azure VMs, one for the Web server and one for the SQL Server.
  • Both VMs were in the same virtual network, but each had it's own NSG.

I noticed that even when I was setting up rules in the NSG for the SQL Server VM, the rules defined in the NSG for my other Web server VM still applied.

I resolved it by using only single NSG for the whole virtual network (both VMs) and defining the rules there. But that sure was some unexpected behavior that took me a while to track down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.