I can't find anything online that explains how to resolve this error, does anyone have any idea?

SQL Server database port 1433 is exposed to the Internet. We do not recommend exposing database ports to the Internet and suggest only exposing them to your front-end tier inside your virtual network

I've tried using service tags and Address Space but this just blocks connections. I need to be able to connect to the SQL Virtual Machine through SSMS and also have data factory and an azure sql server instance talk to it, but my only choices are either opening the thing up to all IP addresses (in which case this error is returned), or just limiting it to my own IP address. I can't believe googling this problem gives me NO results but here we are.

I don't even know where to start. Is there anywhere with instructions on how to only expose a port to a virtual network, so I can have it connect to Azure SQL Server and data factory instances?


In Azure, you're not limited to public networks.

They have Azure Virtual Network to create a private network between your VMs, then using Azure VPN Gateway you can connect via P2S VPN into this private network, getting a local VN IP address, and connect to your Azure SQL Server instance with SSMS.

After configuring private VNs, you can use Azure VN NAT to give your outbound services (e.g. IIS) public IP addresses.

You will need to plan for this in advance, but for a simple IIS service, you'll only need one VN to connect your IIS to your SQL server, and then NAT-ing your IIS VM to public IP.

There are a few guides by Microsoft about this, e.g.

but you'll need to adjust those according to your infrastructure plan.

| improve this answer | |
  • I will check this out, thank you so much for your help! – Aware Aug 7 at 8:23
  • I've set up a gateway and and NAT but I can't find any way of linking SQL server to a NAT, anyone? – Aware Aug 7 at 13:28
  • no. don't. please. why though? it's a very bad idea. if you want to connect to your SQL server, you can see that I'm suggesting you to create a P2S VPN Gateway, connect to that, and then run SSMS via SQL Server's private IP address. I've added a official tutorial link about how-to connect SSMS to a managed SQL Server instance via P2S VPN. – mforsetti Aug 7 at 17:01
  • It didn't work. I've tested connectivity in Connection Troubleshoot on Azure and it allows connectivity from the VirtualNetwork service tag. When I try to connect through SSMS, I'm connected to the virtual network but I think it's still receiving the request through my IP address instead of the virtual network. Connecting to the vpn didn't make any difference, shouldn't it change my ip address? Is that where I'm going wrong? – Aware Aug 10 at 9:30

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.