HOWTOIntermediate

FortiGate IPsec VPN: Site-to-Site with Azure

Configure IPsec site-to-site VPN between FortiGate firewall and Azure VPN Gateway. Covers IKE configuration, routing, BGP, and high availability.

Dylan H.

Network Engineering

February 3, 2026
13 min read
FortiGate IPsec VPN: Site-to-Site with Azure

Prerequisites

  • FortiGate firewall with public IP
  • Azure subscription with Virtual Network
  • Basic understanding of IPsec VPN concepts
  • Network Administrator access to both environments

Overview

Site-to-site IPsec VPN provides encrypted connectivity between on-premises networks and Azure Virtual Networks. This configuration enables hybrid cloud architectures, allowing secure access to Azure resources from on-premises locations and vice versa.

Who Should Use This Guide:

  • Network engineers connecting on-premises to Azure
  • Security architects implementing hybrid cloud security
  • Cloud engineers extending corporate networks to Azure
  • MSPs building multi-cloud connectivity solutions

Azure VPN Options:

VPN TypeUse CaseFortiGate Requirement
Policy-basedSimple connectivity, single tunnelStandard IPsec
Route-basedMultiple tunnels, BGP, redundancyRoute-based VPN (recommended)
ExpressRouteHigh bandwidth, dedicated connectionNot IPsec (private circuit)

Architecture Options:

ConfigurationDescription
Single tunnelOne FortiGate to one Azure VPN Gateway
Active-PassivePrimary + standby tunnel for HA
Active-ActiveDual tunnels with load balancing
BGPDynamic routing with automatic failover

Requirements

FortiGate Requirements:

ComponentRequirement
FortiOS Version6.4 or later (7.x recommended)
LicenseAny license tier
Public IPStatic public IP on WAN interface
FirmwareLatest stable release

Azure Requirements:

ComponentRequirement
SubscriptionActive Azure subscription
Virtual NetworkVNet with address space defined
Gateway Subnet/27 or larger dedicated subnet
VPN Gateway SKUVpnGw1 or higher (route-based)

Network Planning:

NetworkAddress SpaceExample
On-Premises LANCorporate network10.0.0.0/8
Azure VNetCloud network172.16.0.0/16
Gateway SubnetAzure VPN subnet172.16.255.0/27
VPN TunnelPoint-to-pointNot required for Azure

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                    IPsec Site-to-Site VPN Architecture              │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│  On-Premises                           Azure Cloud                  │
│  ┌────────────────┐                   ┌────────────────────────┐   │
│  │  Internal LAN  │                   │     Azure VNet         │   │
│  │  10.0.0.0/8    │                   │   172.16.0.0/16        │   │
│  │                │                   │                        │   │
│  │  ┌──────────┐  │                   │  ┌──────────────────┐  │   │
│  │  │ Servers  │  │                   │  │  Azure VMs       │  │   │
│  │  │ Clients  │  │                   │  │  172.16.1.0/24   │  │   │
│  │  └──────────┘  │                   │  └──────────────────┘  │   │
│  │       │        │                   │           │            │   │
│  └───────┼────────┘                   └───────────┼────────────┘   │
│          │                                        │                 │
│  ┌───────┴────────┐                   ┌───────────┴────────────┐   │
│  │   FortiGate    │                   │    Azure VPN Gateway   │   │
│  │   Firewall     │                   │    VpnGw1 or higher    │   │
│  │                │                   │                        │   │
│  │  WAN: x.x.x.x  │     IPsec VPN     │   Public IP: y.y.y.y   │   │
│  │  (Public IP)   │◀═══════════════▶ │   (Azure assigned)     │   │
│  └────────────────┘    IKEv2/AES256   └────────────────────────┘   │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

Process

Step 1: Create Azure Virtual Network and Gateway Subnet

Set up the Azure networking foundation.

Create Virtual Network:

# Azure CLI
az network vnet create \
  --resource-group HybridNetwork-RG \
  --name AzureVNet \
  --address-prefix 172.16.0.0/16 \
  --subnet-name Workloads \
  --subnet-prefix 172.16.1.0/24 \
  --location eastus

Create Gateway Subnet:

# Gateway subnet must be named "GatewaySubnet"
az network vnet subnet create \
  --resource-group HybridNetwork-RG \
  --vnet-name AzureVNet \
  --name GatewaySubnet \
  --address-prefix 172.16.255.0/27

Important: The gateway subnet must be at least /27 (32 addresses) for production deployments.


Step 2: Deploy Azure VPN Gateway

Create the VPN gateway (takes 20-45 minutes).

Create Public IP for Gateway:

az network public-ip create \
  --resource-group HybridNetwork-RG \
  --name VPNGateway-PIP \
  --allocation-method Static \
  --sku Standard \
  --zone 1 2 3

Create VPN Gateway:

az network vnet-gateway create \
  --resource-group HybridNetwork-RG \
  --name AzureVPNGateway \
  --public-ip-address VPNGateway-PIP \
  --vnet AzureVNet \
  --gateway-type Vpn \
  --vpn-type RouteBased \
  --sku VpnGw1 \
  --generation Generation1 \
  --no-wait

VPN Gateway SKUs:

SKUTunnelsThroughputBGPUse Case
VpnGw130650 MbpsYesSmall/Medium
VpnGw2301 GbpsYesMedium
VpnGw3301.25 GbpsYesLarge
VpnGw1AZ30650 MbpsYesZone redundant

Check Deployment Status:

az network vnet-gateway show \
  --resource-group HybridNetwork-RG \
  --name AzureVPNGateway \
  --query "provisioningState"

Wait until provisioningState shows Succeeded.


Step 3: Create Local Network Gateway (FortiGate Representation)

Define the on-premises network in Azure.

az network local-gateway create \
  --resource-group HybridNetwork-RG \
  --name OnPremFortiGate \
  --gateway-ip-address <FortiGate-Public-IP> \
  --local-address-prefixes 10.0.0.0/8 \
  --location eastus

For BGP Configuration:

az network local-gateway create \
  --resource-group HybridNetwork-RG \
  --name OnPremFortiGate \
  --gateway-ip-address <FortiGate-Public-IP> \
  --local-address-prefixes 10.0.0.0/8 \
  --asn 65001 \
  --bgp-peering-address 10.0.0.1 \
  --location eastus

Step 4: Create VPN Connection in Azure

Establish the connection with shared key.

Generate Strong Pre-Shared Key:

# Generate random PSK (save this securely!)
openssl rand -base64 32
# Example output: Kj8mN2xQp5wR9tYv3zA7bC1dE4fG6hI+

Create Connection:

az network vpn-connection create \
  --resource-group HybridNetwork-RG \
  --name Azure-to-FortiGate \
  --vnet-gateway1 AzureVPNGateway \
  --local-gateway2 OnPremFortiGate \
  --shared-key "YourSecureSharedKey123!" \
  --enable-bgp false

Connection with Custom IPsec Policy:

az network vpn-connection create \
  --resource-group HybridNetwork-RG \
  --name Azure-to-FortiGate \
  --vnet-gateway1 AzureVPNGateway \
  --local-gateway2 OnPremFortiGate \
  --shared-key "YourSecureSharedKey123!" \
  --ipsec-policies "[{
    \"saLifeTimeSeconds\": 27000,
    \"saDataSizeKilobytes\": 102400000,
    \"ipsecEncryption\": \"AES256\",
    \"ipsecIntegrity\": \"SHA256\",
    \"ikeEncryption\": \"AES256\",
    \"ikeIntegrity\": \"SHA256\",
    \"dhGroup\": \"DHGroup14\",
    \"pfsGroup\": \"PFS2048\"
  }]"

Step 5: Configure FortiGate Phase 1 (IKE)

Set up the IKE configuration on FortiGate.

Get Azure VPN Gateway Public IP:

az network public-ip show \
  --resource-group HybridNetwork-RG \
  --name VPNGateway-PIP \
  --query "ipAddress" -o tsv

FortiGate CLI Configuration:

config vpn ipsec phase1-interface
    edit "Azure-VPN"
        set interface "port1"
        set ike-version 2
        set keylife 28800
        set peertype any
        set net-device disable
        set proposal aes256-sha256
        set dpd on-idle
        set dhgrp 14
        set remote-gw <Azure-VPN-Gateway-Public-IP>
        set psksecret "YourSecureSharedKey123!"
        set dpd-retryinterval 10
    next
end

GUI Configuration:

  1. Navigate to VPN → IPsec Tunnels
  2. Click Create New → IPsec Tunnel
  3. Select Custom
  4. Configure:
SettingValue
NameAzure-VPN
Remote GatewayStatic IP Address
IP AddressAzure VPN Gateway Public IP
InterfaceWAN interface (port1)
NAT TraversalEnable (if behind NAT)
Dead Peer DetectionOn Idle

Phase 1 Proposal:

SettingValue
IKE Version2
EncryptionAES256
AuthenticationSHA256
Diffie-Hellman Group14 (2048-bit)
Key Lifetime28800 seconds

Authentication:

SettingValue
MethodPre-shared Key
Pre-shared KeySame as Azure connection

Step 6: Configure FortiGate Phase 2 (IPsec)

Define the traffic selectors and encryption.

CLI Configuration:

config vpn ipsec phase2-interface
    edit "Azure-VPN-P2"
        set phase1name "Azure-VPN"
        set proposal aes256-sha256
        set pfs enable
        set dhgrp 14
        set auto-negotiate enable
        set keylifeseconds 27000
        set src-addr-type name
        set dst-addr-type name
        set src-name "OnPrem-Networks"
        set dst-name "Azure-Networks"
    next
end

Create Address Objects:

# On-premises network
config firewall address
    edit "OnPrem-Networks"
        set type ipmask
        set subnet 10.0.0.0 255.0.0.0
    next
end
 
# Azure VNet
config firewall address
    edit "Azure-Networks"
        set type ipmask
        set subnet 172.16.0.0 255.255.0.0
    next
end

Phase 2 Settings:

SettingValue
NameAzure-VPN-P2
EncryptionAES256
AuthenticationSHA256
Enable PFSYes
DH Group14
Key Lifetime27000 seconds
Auto-negotiateEnable

Step 7: Configure Routing

Set up routing for VPN traffic.

Static Route Configuration:

config router static
    edit 0
        set dst 172.16.0.0 255.255.0.0
        set device "Azure-VPN"
        set comment "Route to Azure VNet"
    next
end

For Multiple Azure Subnets:

config router static
    edit 0
        set dst 172.16.1.0 255.255.255.0
        set device "Azure-VPN"
        set comment "Azure Workload Subnet"
    next
    edit 0
        set dst 172.16.2.0 255.255.255.0
        set device "Azure-VPN"
        set comment "Azure Database Subnet"
    next
end

Verify Routing:

# Show routing table
get router info routing-table all
 
# Show routes for specific destination
get router info routing-table details 172.16.0.0/16

Step 8: Configure Firewall Policies

Allow traffic through the VPN tunnel.

LAN to Azure Policy:

config firewall policy
    edit 0
        set name "LAN-to-Azure"
        set srcintf "internal"
        set dstintf "Azure-VPN"
        set srcaddr "OnPrem-Networks"
        set dstaddr "Azure-Networks"
        set action accept
        set schedule "always"
        set service "ALL"
        set logtraffic all
        set comments "Allow on-prem to Azure VNet"
    next
end

Azure to LAN Policy:

config firewall policy
    edit 0
        set name "Azure-to-LAN"
        set srcintf "Azure-VPN"
        set dstintf "internal"
        set srcaddr "Azure-Networks"
        set dstaddr "OnPrem-Networks"
        set action accept
        set schedule "always"
        set service "ALL"
        set logtraffic all
        set comments "Allow Azure VNet to on-prem"
    next
end

More Restrictive Policy Example:

config firewall policy
    edit 0
        set name "Azure-to-LAN-Limited"
        set srcintf "Azure-VPN"
        set dstintf "internal"
        set srcaddr "Azure-Networks"
        set dstaddr "OnPrem-Servers"
        set action accept
        set schedule "always"
        set service "HTTPS" "SSH" "RDP"
        set logtraffic all
        set utm-status enable
        set av-profile "default"
        set ips-sensor "default"
    next
end

Step 9: Verify VPN Tunnel Status

Confirm the tunnel is established.

FortiGate CLI Verification:

# Check Phase 1 status
diagnose vpn ike gateway list name Azure-VPN
 
# Check Phase 2 status
diagnose vpn tunnel list name Azure-VPN
 
# View IPsec SA details
get vpn ipsec tunnel summary
 
# Real-time tunnel debug
diagnose debug application ike -1
diagnose debug enable

Expected Output (Phase 1 up):

vd: root/0
name: Azure-VPN
version: 2
interface: port1 10
addr: <FortiGate-IP>:<Azure-VPN-IP>
created: 120s ago
IKE SA: created 1/1
IPsec SA: created 1/1

Azure CLI Verification:

# Check connection status
az network vpn-connection show \
  --resource-group HybridNetwork-RG \
  --name Azure-to-FortiGate \
  --query "connectionStatus"
 
# View connection details
az network vpn-connection show \
  --resource-group HybridNetwork-RG \
  --name Azure-to-FortiGate

GUI Verification:

  1. FortiGate: Monitor → IPsec Monitor - Status should show green "Up"
  2. Azure Portal: VPN Connections → Azure-to-FortiGate - Status "Connected"

Step 10: Test Connectivity

Validate end-to-end traffic flow.

From On-Premises to Azure:

# Ping Azure VM
ping 172.16.1.4
 
# Traceroute to verify path
tracert 172.16.1.4
 
# Test specific service
Test-NetConnection -ComputerName 172.16.1.4 -Port 443

From Azure VM to On-Premises:

# Ping on-prem server
ping 10.0.1.10
 
# Test RDP connectivity
Test-NetConnection -ComputerName 10.0.1.10 -Port 3389

Monitor Traffic on FortiGate:

# Packet sniffer for VPN traffic
diagnose sniffer packet Azure-VPN 'host 172.16.1.4' 4 10
 
# View session table
diagnose sys session filter dst 172.16.0.0/16
diagnose sys session list

Advanced Configuration

Enable BGP for Dynamic Routing

Configure BGP for automatic route exchange.

Azure BGP Configuration:

# Get Azure VPN Gateway BGP info
az network vnet-gateway show \
  --resource-group HybridNetwork-RG \
  --name AzureVPNGateway \
  --query "bgpSettings"

FortiGate BGP Configuration:

config router bgp
    set as 65001
    set router-id <FortiGate-LAN-IP>
    config neighbor
        edit "<Azure-BGP-Peer-IP>"
            set remote-as 65515
            set ebgp-enforce-multihop enable
            set soft-reconfiguration enable
        next
    end
    config network
        edit 1
            set prefix 10.0.0.0 255.0.0.0
        next
    end
end

High Availability Configuration

Set up dual tunnels for redundancy.

Active-Passive with Azure:

  1. Deploy Azure VPN Gateway in Active-Passive mode (default)
  2. Create two Phase 1 tunnels on FortiGate
  3. Configure priority routing
# Primary tunnel route (lower distance = preferred)
config router static
    edit 0
        set dst 172.16.0.0 255.255.0.0
        set device "Azure-VPN-Primary"
        set distance 10
    next
    edit 0
        set dst 172.16.0.0 255.255.0.0
        set device "Azure-VPN-Secondary"
        set distance 20
    next
end

Troubleshooting

Common Issues:

SymptomPossible CauseSolution
Phase 1 not establishingMismatched proposalsVerify IKE version, encryption, DH group
Phase 2 failingTraffic selector mismatchCheck source/destination networks match
Tunnel up, no trafficMissing routes or policiesVerify static routes and firewall policies
Intermittent connectivityDPD timeoutAdjust DPD settings; check NAT
One-way trafficAsymmetric routingCheck return path routing

FortiGate Debug Commands:

# IKE negotiation debug
diagnose debug reset
diagnose vpn ike log-filter dst-addr4 <Azure-VPN-IP>
diagnose debug application ike -1
diagnose debug enable
 
# Wait for negotiation, then:
diagnose debug disable
 
# Check for errors
diagnose vpn ike error

Azure Diagnostics:

# View connection status with details
az network vpn-connection show \
  --resource-group HybridNetwork-RG \
  --name Azure-to-FortiGate \
  --query "{Status:connectionStatus,Bytes:ingressBytesTransferred}"
 
# Check gateway health
az network vnet-gateway show \
  --resource-group HybridNetwork-RG \
  --name AzureVPNGateway \
  --query "provisioningState"

IPsec Proposal Compatibility:

SettingAzure SupportedFortiGate Setting
IKE VersionIKEv22
EncryptionAES256, AES128aes256 or aes128
IntegritySHA256, SHA1sha256 or sha1
DH Group2, 14, 242, 14, or 24
PFS GroupPFS2048, None14 or disable

Security Considerations

Pre-Shared Key Security:

  • Generate minimum 32-character random key
  • Store in secure vault (Azure Key Vault, password manager)
  • Rotate annually or after personnel changes

Network Segmentation:

# Create specific policies instead of "ALL" services
config firewall policy
    edit 0
        set name "Azure-Web-Servers"
        set srcintf "internal"
        set dstintf "Azure-VPN"
        set srcaddr "Developer-Subnet"
        set dstaddr "Azure-WebTier"
        set service "HTTPS" "SSH"
        set action accept
    next
end

Enable Logging:

# Ensure all VPN policies log traffic
config firewall policy
    edit <policy-id>
        set logtraffic all
        set logtraffic-start enable
    next
end

IPS on VPN Traffic:

config firewall policy
    edit <policy-id>
        set utm-status enable
        set ips-sensor "high-security"
    next
end

Verification Checklist

Azure Configuration:

  • Virtual Network created with correct address space
  • Gateway Subnet created (/27 or larger)
  • VPN Gateway deployed and provisioned
  • Local Network Gateway configured with FortiGate IP
  • VPN Connection created with shared key

FortiGate Configuration:

  • Phase 1 configured with matching proposals
  • Phase 2 configured with correct selectors
  • Static routes to Azure networks added
  • Firewall policies allow VPN traffic
  • Address objects created for both networks

Connectivity Testing:

  • Phase 1 status shows "Up"
  • Phase 2 status shows "Up"
  • Ping from on-prem to Azure VM successful
  • Ping from Azure VM to on-prem successful
  • Application traffic flows correctly

Next Steps

After establishing the VPN:

  1. Enable Azure Firewall - Inspect traffic entering Azure
  2. Configure Network Security Groups - Segment Azure subnets
  3. Implement Azure Private DNS - Resolve internal hostnames
  4. Set Up Monitoring - Azure Monitor and FortiAnalyzer alerts

References


Last Updated: February 2026