Two SQL Managed Instances in separate virtual networks, two VPNs needed - how to make 1 VPN sufficient for connecting to both SQL Managed Instances' local endpoints?

Aleksey Vitsko 20 Reputation points
2024-05-09T17:19:26.13+00:00

Hello,

We have two SQL Managed Instances (MI-1 and MI-2) in two virtual networks (vNet-1 and vNet-2) in separate regions.

Global virtual network peering is configured between two virtual networks.

SQL Managed Instances are joined into Failover Group.

MI-1 is primary and MI-2 is secondary.

Failover Group's endpoints are FG and FG.secondary respectively.

Both virtual networks have each own VPN gateways (vNet-gateway-1 and vNet-gateway-2).

Both VPN gateways have point-to-site VPNs (VPN-1 and VPN-2) configured, with "Azure Active Directory" authentication.

Issue:

When we connect to VPN-1, we can connect to MI-1 and FG local (internal) endpoints in SSMS.

But we cannot connect to MI-2 and FG.secondary local (internal) endpoints while connected to VPN-1. Error is:

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.) (Framework Microsoft SqlClient Data Provider)

Vice versa, when we are connected to VPN-2 - we can connect to MI-2 and FG.secondary local (internal) endpoints in SSMS.

But we cannot connect to MI-1 and FG local (internal) endpoints while connected to VPN-2.

Question:

How can we make MI-2 and FG.secondary be accessible over VPN-1, and/or make MI-1 and FG be accessible over VPN-2 ?

The ultimate goal is to make just one VPN be sufficient for connections to both MI-1 and MI-2 (FG and FG.secondary) in different regions.

Azure VPN Gateway
Azure VPN Gateway
An Azure service that enables the connection of on-premises networks to Azure through site-to-site virtual private networks.
1,400 questions
{count} votes

Accepted answer
  1. Silvia Wibowo 3,166 Reputation points Microsoft Employee
    2024-05-15T02:19:40.6333333+00:00

    Hi @Aleksey Vitsko , from your screenshots of NIC routes and NSG:

    • You have NSG inbound entry on MI-2: source 172.16.x.x -> is this your on-premises?
    • There is no route for 172.16.x.x, so MI-2 does not know where to route the reply traffic.

    What you can do, either:

    1. Enable BGP if your VPN Gateway SKU is not Basic (Basic does not support BGP), or
    2. Create an entry on the route table applied to MI-2 subnet: 172.16.x.x (your on-premises CIDR) next hop: Virtual Network Gateway.

    If you go with #2, these are the pre-requisites:

    • you can't have a Virtual Network Gateway (VPN Gateway) locally at MI-2 vNet
    • do not peer MI-2 vNet with any other vNet that has a VPN Gateway, make sure that MI-2 vNet is only peered with one vNet that has a vNet gateway (VPN vNet)
    • enable transit on the peerings:
      • peering of VPN vNet to MI-2 vNet -> Allow both traffic settings (traffic to remote virtual network and traffic forwarded from remote virtual network), Use this virtual network's gateway
      • peering of MI-2 vNet to VPN vNet -> Allow both traffic settings (traffic to remote virtual network and traffic forwarded from remote virtual network), Use remote virtual network's gateway

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.


0 additional answers

Sort by: Most helpful