Linking Azure VNets Across Subscriptions with a Single S2S Connection

Anonymous
2023-06-13T08:24:54.3166667+00:00

Hi all,

I am facing the blocker described bellow. I need a helping hand in spotting what I am missing. Thanks in advance.

Senario:

  • In subscription 1, RG1 I have Vnet1 and An Azure Gateway VPN, Vnet1 has S2S VPN connection to on-prem site.
  • In subscription 2, RG2 I have Vnet2 and an Azure Gateway VPN

What I want:

  • I want to be able to access from on-prem site Vnet1 and Vnet2, without creating S2S connection to on-prem for each VNET (see picture (essentially the red path in the diagram))
    User's image

What I have already tried:

What I have already tried:

Try no 1:

VNet-to-Vnet VPN connection between Vnet1 and Vnet2 using instruction from MS official documentation

The Connection Status was Connected on both sides, however I was not able to reach resources in Vnet2 from devices on On-Prem Site.

I have tried additional configuration to establish communication from Vnet2 to On-Prem Site through the VNet-to-VNet VPN and S2S VPN connections , by using Route Table with routs on both pars, but with no success.

Using VNet Peering is not an option for my current architecture.

Try no 2:

S2S (IPSec) VPN connection between the 2 Vnets. <VNET2> ---S2S VPN--- <VNET1>

Which include the following 2 parts:

S2S connection between Virtual network gateway VnetGW1 (subscription 1) and Local Network Gateway named LocalNetworkGW2 in subscription 2 S2S connection between Virtual network gateway VnetGW2 (subscription 2) and Local Network Gateway named LocalNetworkGW1 in subscription 1

S2S connection between Virtual network gateway VnetGW1 (subscription 1) and Local Network Gateway named LocalNetworkGW2 in subscription 2 S2S connection between Virtual network gateway VnetGW2 (subscription 2) and Local Network Gateway named LocalNetworkGW1 in subscription 1

Steps:

# Signin to Subscription 1
$ az account set --subscription ID-Subs1

# Create S2S connection from Virtual Network Gateway subs1  to Local Network Gateway subs2
$ az network vpn-connection create --name VnetGW1toLocalNetworkGW2 --resource-group RG1 --vnet-gateway1 VnetGW1 -l westeurope --shared-key "abc123" --local-gateway2 /subscriptions/ID-Subs2/resourceGroups/RG2/providers/Microsoft.Network/localNetworkGateways/LocalNetworkGW2


# Signin to Subscription 1
$ az account set --subscription ID-Subs2
$ az network vpn-connection create --name VnetGW2toLocalNetworkGW1 --resource-group RG2 --vnet-gateway1 VnetGW2 -l westeurope --shared-key "abc123" --local-gateway2 /subscriptions/ID-Subs1/resourceGroups/RG1/providers/Microsoft.Network/localNetworkGateways/LocalNetworkGW1

Note:

If you try to go in Local Network Gateway named LocalNetworkGW2 and Configure Adress Space by adding the VNET2 IP adress-space, and then run the command to create the S2S connection.

You will get the following error code "ConnectionOverlappingAddressSpaces" This is because at S2S connection creation via comand line the Local Network Gateway gets updated with the VNET2 IP adress-space, so there is no need to add it manually*

Issue:

  • The commands of creating S2S finished with no error, however the "connectionStatus": "NotConnected" on both end, so I still do not have the desired access
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,795 questions
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 49,611 Reputation points Microsoft Employee Moderator
    2023-06-14T12:16:50.2533333+00:00

    @Anonymous

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you would like to achieve transit routing via VPN Connections between Azure Site and OnPrem via another Azure Site.

    Technically, this should be possible.

    Method 1: BGP

    Using a S2S for connecting two VPN Gateways in Azure would be an overkill.

    • VNet-to-Vnet will work exactly as desires as long as all the two connections, Vnet1-to-OnPrem S2S and Vnet1-to-Vnet2 VPN Connection both have BGP enabled.
    • I see the documentation you have shared for Vnet-to-Vnet does not configure BGP by default.
    • I would recommend you to enable BGP in all the connections and give it a try.

    Please note : This configuration would not work if you do not enable BGP even with S2S between the VNets.

    Your exact requirement is documented here

    User's image

    Method2: Adding the OnPrem Address range in LNG representing Transit VPN Gateway.

    Note : Here, VPN Connection between the VPN Gateways should be a S2S and not Vnet-to-Vnet.

    First, establish the VPN connection between VPN Gateways

    • User's image
    • Note :
      • The S2S Connection object is created within the subscription (VPNGW and LNG are in same subscription)
      • Address range of each LNG comes from the other VPNGW (Vnet)
    • Once the connection is successful, you can add the address range of the Onprem in the LNG representing the transit Gateway.
    • User's image
    • This should enable routing to the Onprem.

    You have also added some additional configurations for an end-to-end connectivity : https://medium.com/@andragabr/connect-from-onprem-to-azure-vnets-across-subscriptions-1b89306d15ef

    Thanks for your continued contribution on Q&A and appreciate much for taking the time to work with us

    Cheers

    Kapil :)


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. munirtajudin 5 Reputation points
    2023-06-13T11:15:37.3233333+00:00

    From my understanding, you want to use s2s via vnet1 in sub1 to vnet2 in sub2. And u have deployed vpn gateway from both vnet. Here is my 2 cent 1. Deleve vpn gateway in vnet 2 because this will cause an error on next step 2.Connect vnet1 and vnet2 using vnet peering. 3. On peering setting, there is source vnet setting which allow gateway transit and target vnet setting there an option to use remote gateway. Test connection and feedback if still not successful


  2. Anonymous
    2023-06-14T11:43:06.0266667+00:00

    SOLVED:

    I created an article here with the solution for different scenarios:
    https://medium.com/@andragabr/connect-from-onprem-to-azure-vnets-across-subscriptions-1b89306d15ef

    Thank you all for support <3

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.