Skip to main content
Version: Next

Task 03: Site-to-Site VPN Connection

Runbook Azure

DOCUMENT CATEGORY: Runbook SCOPE: S2S VPN Connection deployment PURPOSE: Establish IPsec tunnel to on-premises network MASTER REFERENCE: Microsoft Learn - S2S VPN Connection

Status: Active


Overview

This task creates the Local Network Gateway (representing the on-premises VPN device) and the Site-to-Site VPN Connection linking the Azure VPN Gateway (Task 02) to the on-premises network. The shared key is stored in Key Vault and retrieved at deployment time.

Task Classification

Execution Target: Azure-Only (control-plane API operation) Tab Profile: 3 tabs — Azure Portal · Azure CLI / PowerShell · Standalone Script

Terraform Reference

Module: azurelocal-toolkit File: network.tf Mode: Management

Components Created

ResourceName PatternPurpose
Local Network Gatewaylgw-{workload}-{env}-{region}-{instance}On-prem VPN device representation
VPN Connectionvnc-{workload}-{env}-{region}-{instance}IPsec/IKEv2 tunnel

Connection Configuration

SettingValueSource
Connection TypeIPsecnetwork.vpn.connection.type
ProtocolIKEv2network.vpn.connection.protocol
BGP EnabledPer confignetwork.vpn.connection.enable_bgp
Routing WeightPer confignetwork.vpn.connection.routing_weight
Shared KeyKey Vault referencenetwork.vpn.connection.shared_key

Prerequisites

  • Task 02: VPN Gateway completed — VPN Gateway is provisioned
  • On-premises VPN device IP confirmed (e.g., network.vpn.local_gateway.gateway_ip)
  • On-premises address prefixes confirmed (e.g., network.vpn.local_gateway.local_address_prefixes)
  • Shared key stored in Key Vault at the URI in network.vpn.connection.shared_key
  • BGP ASN for on-premises device confirmed (if BGP enabled)

Variables from variables.yml

VariableConfig PathExample (IIC)
Subscription IDazure.subscriptions.<name>.id(per environment)
Local Gateway Namenetwork.vpn.local_gateway.namelgw-azrl-azl-eus-01
Local Gateway Resource Groupnetwork.vpn.local_gateway.resource_grouprg-azrlmgmt-azl-eus-01
On-Prem Gateway IPnetwork.vpn.local_gateway.gateway_ip(per site)
On-Prem Address Prefixesnetwork.vpn.local_gateway.local_address_prefixes["10.0.0.0/24"]
Connection Namenetwork.vpn.connection.namevnc-azrl-azl-eus-01
Connection Typenetwork.vpn.connection.typeIPsec
BGP Enablednetwork.vpn.connection.enable_bgptrue
Shared Keynetwork.vpn.connection.shared_keykeyvault://...

Single Subscription Model

Landing Zone Placement

FieldValueConfig Path
SubscriptionCustomer subscriptionazure.subscriptions.<name>.id
Resource Grouprg-{workload}-{env}-{region}-01network.vpn.local_gateway.resource_group
Local Gateway Namelgw-{workload}-{env}-{region}-01network.vpn.local_gateway.name
Connection Namevnc-{workload}-{env}-{region}-01network.vpn.connection.name

Execution Options

Azure Portal

When to use: Learning Azure Local, single deployment, prefer visual interface

Procedure

  1. Create Local Network Gateway:
  • Search for Local network gateways+ Create | Field | Value | Source | |-------|-------|--------| | Name | lgw-{workload}-{env}-{region}-01 | network.vpn.local_gateway.name | | Resource Group | Same as VPN Gateway | network.vpn.local_gateway.resource_group | | Region | Your region | azure.region | | Endpoint | IP address | — | | IP address | On-prem device IP | network.vpn.local_gateway.gateway_ip | | Address Space | On-prem prefixes | network.vpn.local_gateway.local_address_prefixes |
  1. Configure BGP on Local Gateway (if enabled): | Field | Value | Source | |-------|-------|--------| | Configure BGP | Yes | network.vpn.local_gateway.bgp.enabled | | ASN | On-prem ASN | network.vpn.local_gateway.bgp.asn | | BGP peer address | On-prem BGP peer | network.vpn.local_gateway.bgp.bgp_peering_address |

  2. Create VPN Connection:

  • Navigate to VPN Gateway → Connections+ Add | Field | Value | Source | |-------|-------|--------| | Name | vnc-{workload}-{env}-{region}-01 | network.vpn.connection.name | | Connection type | Site-to-site (IPsec) | network.vpn.connection.type | | Local network gateway | Select from Step 1 | network.vpn.local_gateway.name | | Shared key (PSK) | From Key Vault | network.vpn.connection.shared_key | | IKE Protocol | IKEv2 | network.vpn.connection.protocol | | Enable BGP | Per config | network.vpn.connection.enable_bgp |
  1. Configure On-Premises Device: Configure the on-premises VPN device (e.g., network.vpn.local_gateway.device) with matching settings.

  2. Review + create: Verify → Click OK

Validation

  • Local Network Gateway provisioning state: Succeeded
  • VPN Connection status: Connected
  • BGP peers established (if BGP enabled)

Validation

  • Local Network Gateway provisioned
  • VPN Connection status: Connected
  • BGP peering established (if enabled)
  • On-premises routes visible in effective routes

CAF/WAF Landing Zone Model

In the CAF/WAF model, the Local Network Gateway and VPN Connection are deployed in the Connectivity subscription alongside the VPN Gateway.

Landing Zone Placement

FieldValueConfig Path
SubscriptionConnectivity subscriptionazure.subscriptions.connectivity.id
Resource Grouprg-azrlconn-{env}-{region}-01network.vpn.local_gateway.resource_group
Local Gateway Namelgw-{workload}-{env}-{region}-01network.vpn.local_gateway.name
Connection Namevnc-{workload}-{env}-{region}-01network.vpn.connection.name

Execution Options

Azure Portal

When to use: Learning Azure Local, single deployment, prefer visual interface

Follow the same procedure as Single Subscription → Azure Portal above, targeting the Connectivity subscription:

FieldValue
SubscriptionConnectivity subscription
Resource grouprg-azrlconn-{env}-{region}-01

All other settings (local gateway IP, prefixes, BGP, shared key) remain identical.

Validation

  • Resources in Connectivity subscription
  • VPN Connection status: Connected

Validation

  • All resources in Connectivity subscription
  • VPN Connection status: Connected
  • BGP peering active (if enabled)
  • End-to-end connectivity verified from on-premises

Troubleshooting

IssueRoot CauseRemediation
Connection stuck at ConnectingShared key mismatchVerify PSK matches on both sides
Connection stuck at ConnectingOn-prem device not configuredConfigure on-prem VPN device with matching settings
BGP peers not establishedASN mismatch or APIPA mismatchVerify ASN and APIPA addresses match both sides
Cannot resolve Key Vault secretMissing RBAC or network accessAdd Key Vault Secrets User role; check firewall
Local gateway IP incorrectWrong public IP for on-prem deviceUpdate network.vpn.local_gateway.gateway_ip
IKE Phase 1 failureEncryption/integrity mismatchAlign IKE parameters between Azure and on-prem device

PreviousUpNext
Task 02: VPN GatewayManual Deployment IndexTask 04: P2S VPN Connection

Version Control

  • Created: 2025-09-15 by Hybrid Cloud Solutions
  • Last Updated: 2026-03-03 by Hybrid Cloud Solutions
  • Version: 4.0.0
  • Tags: azure-local, vpn-connection, s2s, ipsec, networking
  • Keywords: site-to-site, VPN connection, local network gateway, IPsec, IKEv2, BGP
  • Author: Hybrid Cloud Solutions