- Understand what a site-to-site VPN connection is and how it works.
- Learn when to use a site-to-site VPN versus other connectivity options.
- Walk through the Azure-side configuration and the corresponding on‑premises settings necessary to establish an IPsec/IKE tunnel.
- VPN gateway: An Azure-managed gateway resource that terminates VPN tunnels.
- Local network gateway: An Azure object that represents your on‑premises VPN device and address prefixes.
- Connection: The Azure resource that ties the VPN gateway to the local network gateway and holds the shared key and connection type.
- You need persistent network connectivity between two networks (VNet ↔ on‑premises) without requiring each client to connect individually.
- You want to extend on‑premises addressing to Azure for hybrid applications and management workflows.
- You need a cost-effective solution for lower-to-moderate throughput requirements where ExpressRoute (private peering) isn’t needed.
| Resource Type | Use Case | Typical Example |
|---|---|---|
| Site-to-site VPN | Persistent network-to-network tunnel over internet | Connect datacenter to Azure VNet |
| Point-to-site VPN | Individual client/dev machine remote access | Remote worker connecting to Azure VNet |
| ExpressRoute | Private, high-throughput connection (carrier/partner) | Data replication, low-latency workloads |
- Virtual Network (VNet) with appropriate address space and subnets.
- Public IP address for the VPN gateway.
- VPN gateway (route-based) to terminate the IPsec/IKE tunnel.
- Local network gateway representing your on‑premises public IP and address prefixes.
- Connection resource (site-to-site) containing the shared key and linking the gateways.
- A compatible VPN device (physical or virtual) configured to establish an IPsec/IKE connection with parameters that match the Azure gateway: shared key, IKE version and algorithms, encryption/hashing algorithms, IP addressing, and the correct gateway type (route-based vs policy-based).
| Resource | Purpose | Azure CLI example |
|---|---|---|
| Virtual network | Host subnets and VMs | az network vnet create --name MyVNet --resource-group MyRG --address-prefix 10.0.0.0/16 --subnet-name GatewaySubnet --subnet-prefix 10.0.0.0/24 |
| Public IP | Externally routable IP for VPN gateway | az network public-ip create --name MyVnetGatewayIP --resource-group MyRG --allocation-method Dynamic |
| VPN gateway | Terminates S2S tunnels | az network vnet-gateway create --name MyVpnGateway --resource-group MyRG --vnet MyVNet --public-ip-address MyVnetGatewayIP --gateway-type Vpn --vpn-type RouteBased --sku VpnGw1 --no-wait |
| Local network gateway | Represents on‑premises network | az network local-gateway create --name MyLocalGateway --resource-group MyRG --gateway-ip-address <ONPREM_PUBLIC_IP> --local-address-prefixes 192.168.1.0/24 |
| Connection | Binds Azure gateway to local gateway | az network vpn-connection create --name MyConnection --resource-group MyRG --vnet-gateway1 MyVpnGateway --local-gateway2 MyLocalGateway --shared-key "YourSharedKey123!" |
- Ensure your device supports the IPsec/IKE versions and encryption algorithms you plan to use.
- Match the Azure connection parameters exactly: shared key, IKE version, encryption/hashing algorithms, and any DH/PFS settings required.
- Use route-based (required by many Azure scenarios) or policy-based gateways only when the on‑premises device and Azure gateway types are compatible.
Plan your address spaces and routing before creating resources. Avoid overlapping IP ranges between on‑premises and Azure VNets; if overlap is unavoidable, consider NAT or redesigning subnets to prevent routing conflicts.
- IKE version: IKEv2 is recommended where supported.
- Encryption: AES-256 (or AES-128 for legacy devices).
- Integrity: SHA-256 (or SHA-1 for legacy compatibility).
- Diffie-Hellman: Group 14 (2048-bit) or higher where possible.
- PFS: Enable if both sides support it.
Do not assume default device settings will match Azure’s configuration. Mismatched proposals (IKE version, encryption, hash, DH groups) are the most common causes of failed tunnel negotiations.
- Azure VPN Gateway overview
- Create a site-to-site connection using the Azure CLI
- Azure VPN Gateway SKUs and performance
- Vendor docs for on‑premises devices (Cisco, Juniper, Palo Alto, Fortinet, etc.) for device-specific config examples