Home › Studies › AZ-700 › Connectivity Services › Site-to-Site VPN

Site-to-Site VPN

VPN gateway · SKUs · policy-based vs route-based · local network gateway · active-active · IPsec/IKE policy · troubleshooting · Extended Network

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

Building blocks and how to implement

ResourceWhat it isKey facts
Virtual networkThe Azure side of the connectionIts address space must not overlap the on-premises ranges. Subnets of the on-premises network can't overlap the VNet subnets you connect to.
GatewaySubnetSubnet that holds the gateway VMsMust be named GatewaySubnet. A /29 works for the Basic SKU only; every other SKU needs /27 or larger. Don't deploy anything else into it. NSGs on it aren't supported.
Virtual network gateway (VPN)Two or more Azure-managed VMs; gateway type VpnDeployment can take 45 minutes or more. The gateway region must be the VNet region. A VNet can have one VPN gateway and one ExpressRoute gateway.
Public IP addressOne per gateway instanceNew gateways must use a Standard SKU public IP. It changes only if the gateway is deleted and re-created, not on resize, reset or maintenance.
Local network gatewayRepresents the on-premises site and its VPN deviceHolds the device public IP or FQDN, the on-premises address prefixes and optional BGP settings (peer IP and ASN). One local network gateway per VPN device.
ConnectionLinks the VPN gateway to the local network gatewayConnection type IPsec (portal: Site-to-site (IPSec)). Uses a shared key that must match the device. Default IKE protocol is IKEv2.

Steps

  1. Create the virtual network. Plan the address space with the on-premises administrator so nothing overlaps.
  2. Add the GatewaySubnet (/27 or larger).
  3. Create the VPN gateway: type VPN, a route-based VPN type and an AZ SKU (for example VpnGw2AZ, Generation2) with a Standard public IP. Add a second public IP for active-active.
  4. Create the local network gateway with the device IP (or FQDN) and the on-premises prefixes.
  5. Configure the VPN device with the shared key and the public IP of each gateway instance.
  6. Create the connection and verify that its status goes from Unknown to Connecting to Succeeded (Connected).

Resizing, resetting or maintenance doesn't change the gateway public IP. Replacing a Basic SKU gateway (or changing policy-based to route-based) does, and then the on-premises device and any local network gateways that point at it must be updated.

Gateway SKUs for site-to-site

New gateways use the AZ SKUs, which are recommended for all new deployments and have zone-redundant options. Throughput is an aggregate benchmark and isn't guaranteed.

SKUS2S / VNet-to-VNet tunnelsAggregate throughputBGPZone-redundant
Basic (Gen1)10 (route-based) or 1 (policy-based)100 MbpsNoNo
VpnGw1AZ (Gen1)30650 MbpsYesYes
VpnGw2AZ (Gen1 / Gen2)301 Gbps / 1.25 GbpsYesYes
VpnGw3AZ (Gen1 / Gen2)301.25 Gbps / 2.5 GbpsYesYes
VpnGw4AZ (Gen2)1005 GbpsYesYes
VpnGw5AZ (Gen2)10010 GbpsYesYes

Legacy and non-AZ SKUs are being retired, and Microsoft's pages differ on the dates. Non-AZ VpnGw1 to VpnGw5 can no longer be created (since November 1, 2025). The legacy SKUs page says Standard and High Performance SKUs will be deprecated on June 30, 2026, while the VPN Gateway FAQ says they are retired; the SKU consolidation page says the non-AZ VpnGw1 to VpnGw5 are scheduled for deprecation after September 2026. Existing non-AZ gateways no longer accept configuration changes until migrated. The Basic SKU isn't retiring.

Policy-based or route-based VPN

Policy-basedRoute-based
Older nameStatic routingDynamic routing
Traffic selectorsPrefix combinations from both networksAny-to-any (wildcard); routing tables pick the tunnel
Supported SKUBasic only (IKEv1)Basic (IKEv2); VpnGw1AZ to VpnGw5AZ (IKEv1 and IKEv2)
Tunnels1 S2S tunnelUp to 10 (Basic) or up to 100 (other SKUs)
P2S, BGP, active-active, VNet-to-VNet, multi-siteNot supportedSupported (BGP and active-active not on Basic)
Idle tunnelTorn down after more than five minutes of no traffic, re-established when traffic flows-
Created inPowerShell or CLI only (not the portal since Oct 1, 2023)Portal, PowerShell, CLI (default)

High availability design

Every VPN gateway has two instances. By default they run active-standby: if the active one fails or is under maintenance, the standby takes over. Planned maintenance recovers in about 10 to 15 seconds; unplanned failures take about 1 to 3 minutes in the worst case. P2S clients are disconnected and must reconnect.

DesignGateway modeLocal network gateways and connectionsTunnelsRequirements
DefaultActive-standby---
Multiple on-premises devicesActive-standbyOne local network gateway and one connection per deviceOne per device (several active tunnels)Unique public IP per device; BGP with a unique BGP peer IP per local network gateway; same prefixes advertised; ECMP
Active-active gatewayActive-active1 and 1 (both tunnels belong to the same connection)2Two Standard static public IPs; route-based; not Basic; device must set up a tunnel to each instance
Dual-redundancyActive-active on both sides2 and 24 (full mesh)BGP required, as for multiple devices

IPsec/IKE policy

Without a custom policy the gateway offers a default set of proposals chosen for interoperability. A custom policy is set per connection. It applies to S2S and VNet-to-VNet connections on the VPN gateway, not to ExpressRoute.

ParameterAllowed values or default
IKE (Phase 1, Main Mode) encryptionGCMAES256, GCMAES128, AES256, AES192, AES128
IKE integritySHA384, SHA256, SHA1, MD5
DH group (Phase 1)DHGroup24, ECP384, ECP256, DHGroup14, DHGroup2048, DHGroup2, DHGroup1, None
IPsec (Phase 2, Quick Mode) encryptionGCMAES256, GCMAES192, GCMAES128, AES256, AES192, AES128, DES3, DES, None
IPsec integrityGCMAES256, GCMAES192, GCMAES128, SHA256, SHA1, MD5
PFS group (Phase 2)PFS24, ECP384, ECP256, PFS2048, PFS2, PFS1, None
Quick Mode SA lifetimeOptional. Seconds: minimum 300, default 27,000. Kilobytes: minimum 1,024, default 102,400,000
DPD timeout9 to 3,600 seconds, default 45 (30 to 45 recommended)
Traffic selectorUsePolicyBasedTrafficSelectors true or false, default false
IKE Main Mode SA lifetimeFixed at 28,800 seconds

Troubleshooting and Azure Extended Network

S2S connectivity

Symptom or errorCauseFix
Negotiation timed out (13805)The on-premises device isn't answering IKE messages from AzureCheck the device IP on the local network gateway, whether an on-premises firewall drops IKE packets, the device logs, and that the device supports Azure's default Phase 1 proposals
IKE authentication credentials unacceptable (13801)Preshared key mismatchMake the key on the Azure connection equal to the key on the device tunnel
Policy match error (13868) / No policy configured (13825)IKE/IPsec policy mismatchMatch the custom policy (or default parameters) on the device
Traffic selectors unacceptable (13999)Traffic selector mismatchFix the device selectors, or enable policy-based traffic selectors on the Azure connection
Failure in Diffie-Hellman computation (13822)DH group mismatchMake the DH group the same on both sides
Version of IKE not handled (13880)IKE version mismatchUse the same IKEv1 or IKEv2 on the connection and the device
Remote computer refused the connection (1225)The connection is InitiatorOnly and won't accept requests from the deviceSet connection mode to Default or ResponderOnly
Random disconnectsPerfect forward secrecy mismatch, device IP inside the local network address space, overlapping prefixes across connections, more than 200 subnet SA pairs (the gateway limit)Match or disable PFS (set the Azure PFS group to None if the peer has none), remove the device IP from the address space, review local network gateway prefixes

Azure Extended Network (Windows Admin Center)

CLI and PowerShell

TaskAzure CLIPowerShell
Create a local network gatewayaz network local-gateway create --gateway-ip-address [IP address of your on-premises VPN device] --name Site1 --resource-group TestRG1 --local-address-prefixes 10.3.0.0/16 10.0.0.0/24New-AzLocalNetworkGateway -Name LocalSite -ResourceGroupName testrg -Location 'West US' -GatewayIpAddress '23.99.221.164' -AddressPrefix '10.5.51.0/24'
Create a site-to-site connectionaz network vpn-connection create --name VNet1toSite1 --resource-group TestRG1 --vnet-gateway1 VNet1GW -l eastus --shared-key abc123 --local-gateway2 Site1New-AzVirtualNetworkGatewayConnection -Name VNet1toSite1 -ResourceGroupName TestRG1 -Location 'East US' -VirtualNetworkGateway1 $gateway1 -LocalNetworkGateway2 $local -ConnectionType IPsec -SharedKey 'abc123'
Create an active-active, zone-redundant VPN gatewayaz network vnet-gateway create --name VNet1GW --public-ip-addresses VNet1GWpip1 VNet1GWpip2 --resource-group TestRG1 --vnet VNet1 --gateway-type Vpn --vpn-type RouteBased --sku VpnGw2AZ --vpn-gateway-generation Generation2 --no-waitNew-AzVirtualNetworkGateway -Name VNet1GW -ResourceGroupName TestRG1 -Location "East US" -IpConfigurations $gwipconfig1,$gwipconfig2 -GatewayType "Vpn" -VpnType RouteBased -GatewaySku VpnGw2AZ -VpnGatewayGeneration Generation2 -EnableActiveActiveFeature -Debug
Request a zone-redundant Standard public IP for the gatewayaz network public-ip create --name VNet1GWpip1 --resource-group TestRG1 --allocation-method Static --sku Standard --version IPv4 --zone 1 2 3New-AzPublicIpAddress -Name "VNet1GWpip1" -ResourceGroupName "TestRG1" -Location "EastUS" -AllocationMethod Static -Sku Standard -Zone 1,2,3
Reset a VPN gatewayaz network vnet-gateway reset -n VNet5GW -g TestRG5Reset-AzVirtualNetworkGateway -VirtualNetworkGateway $gw
Check the connection statusaz network vpn-connection show --resource-group "<resource-group>" --name "<connection-name>" --query connectionStatus --output tsv-
View the connection shared keyaz network vpn-connection shared-key show --connection-name VNet1toSite2 --resource-group TestRG1Get-AzVirtualNetworkGatewayConnectionSharedKey -Name <Connection name> -ResourceGroupName <Resource group name>
Check the gateway SKUaz network vnet-gateway show --name "vpn-gateway" --resource-group "test-rg" --query "sku.name"(Get-AzVirtualNetworkGateway -Name "vpn-gateway" -ResourceGroupName "test-rg").Sku.Name
Show the PFS group of a connection's IPsec policyaz network vpn-connection ipsec-policy list --resource-group "<resource-group>" --connection-name "<connection-name>" --query "[].pfsGroup" --output tsv-
Create a custom IPsec/IKE policy object-$ipsecpolicy6 = New-AzIpsecPolicy -IkeEncryption AES256 -IkeIntegrity SHA384 -DhGroup DHGroup24 -IpsecEncryption AES256 -IpsecIntegrity SHA256 -PfsGroup None -SALifeTimeSeconds 14400 -SADataSizeKilobytes 102400000
Update the on-premises prefixes of a local network gateway that has a connection (downtime)az network local-gateway update --local-address-prefixes 10.0.0.0/24 10.3.0.0/16 10.5.0.0/16 10.6.0.0/16 --name VNet1toSite2 -g TestRG1-
Check that the Extended Network agent runs (on each appliance)-get-service extnwagent

Exam Tips

Tick each tip once you can answer it without looking.

“Gateway creation fails or the VPN gateway stops working after a security team adds an NSG” → NSGs on GatewaySubnet aren't supported. Remove the NSG (and any 0.0.0.0/0 UDR) from the gateway subnet.. Trap: Adding rules for UDP 500/4500 to the NSG doesn't make an NSG on the gateway subnet supported.

“Minimum gateway subnet size” → /27 or larger for every SKU except Basic (Basic can use /29). Name it exactly GatewaySubnet.. Trap: /29 only works for the Basic SKU; any other name makes the gateway deployment fail.

“Which resource holds the on-premises device IP and address prefixes?” → The local network gateway.. Trap: The virtual network gateway is the Azure side. The connection holds the shared key.

“On-premises device has a dynamic public IP” → Give the local network gateway an FQDN (Dynamic DNS) as the endpoint. The gateway re-resolves it for disconnected tunnels every 5 minutes.. Trap: You can't convert a local network gateway between IP and FQDN endpoints later; you must create a new one and re-create the connections.

“Policy-based gateway must support point-to-site, BGP or more than one tunnel” → Delete it and create a route-based gateway. A policy-based gateway can't be converted.. Trap: Resizing or a SKU upgrade doesn't change the VPN type. The Basic SKU can't be upgraded at all.

“Connect to an on-premises policy-based firewall from a route-based Azure gateway” → Custom IPsec/IKE policy with UsePolicyBasedTrafficSelectors on the connection (device must support IKEv2).. Trap: Those networks can only reach the Azure VNet; they can't transit through the gateway to other sites or VNets.

“Highest availability for S2S” → Active-active Azure gateway plus two on-premises devices: 2 local network gateways, 2 connections, 4 tunnels, BGP.. Trap: Active-active with a single device that tunnels to only one instance still drops during maintenance.

“Several on-premises devices to the same Azure gateway” → One local network gateway and one connection per device, unique device public IPs and BGP peer IPs, BGP and ECMP.. Trap: The gateway is still active-standby in this design, so the brief failover still happens.

“Active-active gateway requirements and cost” → Route-based, not Basic, two Standard static public IPs (a third if P2S is enabled). The gateway costs the same as active-standby; the extra public IPs are billed.. Trap: Basic and policy-based gateways can't be active-active.

“More than 100 S2S tunnels needed” → Use Virtual WAN. VpnGw4AZ and VpnGw5AZ top out at 100 tunnels.. Trap: No VPN gateway SKU supports more than 100 tunnels.

“Upgrade a Basic SKU to VpnGw2AZ” → Not possible in place. Delete and re-create (downtime, new public IP, update device and P2S clients).. Trap: An in-place upgrade (same public IP, no device change) applies only to SKUs that support it, such as Gen2 to a Gen2 AZ SKU.

“Custom IPsec/IKE policy rules” → One policy per connection, all algorithms specified, any SKU except Basic. SA lifetimes needn't match the device; the rest must.. Trap: Partial policies aren't allowed, and ExpressRoute connections don't use it.

“VNet-to-VNet with custom IPsec/IKE policy won't connect” → Both connection resources (one per direction) must carry the same policy.. Trap: Setting it on only one direction leaves the tunnel unestablished.

“Error 13801 / IKE authentication credentials unacceptable” → Preshared key mismatch between the Azure connection and the device.. Trap: Policy mismatch shows 13868/13825; traffic selector mismatch shows 13999.

“Error 1225 remote computer refused the connection” → Connection mode is InitiatorOnly. Set it to Default or ResponderOnly.. Trap: A wrong shared key shows as 13801 (IKE authentication credentials unacceptable), not 1225.

“Tunnel drops randomly; device has PFS enabled” → Match or disable PFS: set the Azure PFS group to None if the peer has none (apply the full policy).. Trap: Resetting the gateway is the generic first step but it doesn't change the PFS group; the Azure policy has to match the device.

“Check whether the gateway is healthy” → Browse to the gateway IP on port 8081 /healthprobe (8083 for the second active-active IP).. Trap: ICMP ping doesn't work (no reply on the local address), and Basic SKU gateways don't answer the probe.

“On-premises subnet must keep its IP addresses in Azure” → Azure Extended Network: Windows Admin Center, VXLAN between two Windows Server appliances, up to 250 IPs, UDP 4789.. Trap: It isn't a VPN Gateway feature, it needs a gateway connection (S2S or ExpressRoute) underneath, and Azure's appliance must be Windows Server 2022 Azure Edition.

Sources

Checked against Microsoft Learn on November 13, 2026.

← Connectivity Services overviewPoint-to-Site VPN →