Skip to content

🧠 What is Point-to-Site (P2S) VPN?

Image

Image

Point-to-Site VPN allows:

  • A single client machine (laptop)
  • To connect securely to Azure VNet
  • Over an encrypted tunnel

Real-world uses

  • Developers accessing private DBs
  • Admins managing VMs securely
  • Work-from-home access
  • Zero-Trust style access

🧱 Final Architecture (Mental Model)

Developer Laptop
   |
   |  OpenVPN / SSL Tunnel
   |
Azure VPN Gateway
   |
GatewaySubnet
   |
Azure VNet
   |
Private Subnets β†’ VM / App / DB

No on-prem firewall required. No public exposure.


STEP 0️⃣ Prerequisites (Must Have)

Requirement Notes
Azure VPN Gateway Route-based only
SKU VpnGw1 or higher
VNet address space Must NOT overlap P2S pool
Client OS Windows / Linux / macOS

STEP 1️⃣ Choose P2S Authentication Method

Azure supports 3 methods:

Method Use Case Recommendation
Certificate Labs / learning βœ… Start here
Azure AD Enterprise ⭐ Best
RADIUS Legacy ❌ Rare

πŸ‘‰ This tutorial uses Certificate-based auth (best for learning).


STEP 2️⃣ Define P2S Address Pool

This is the IP range given to VPN clients.

⚠️ Must NOT overlap:

  • VNet CIDR
  • On-prem CIDR

Example

VNet        β†’ 10.0.0.0/16
On-prem     β†’ 192.168.1.0/24
P2S clients β†’ 172.16.201.0/24

STEP 3️⃣ Configure P2S on VPN Gateway (Portal)

VPN Gateway β†’ Point-to-site configuration β†’ Configure now

Settings

Field Value
Address pool 172.16.201.0/24
Tunnel type OpenVPN (SSL)
Authentication Azure certificate
Root certificate Upload

πŸ“Œ Do NOT save yet β€” we need certificates first.


STEP 4️⃣ Create Root Certificate (On Your Laptop)

This cert proves β€œI trust clients signed by me”

Create root key

openssl genrsa -out root.key 2048

Create root certificate

openssl req -x509 -new -nodes \
  -key root.key \
  -sha256 -days 365 \
  -out root.crt

βœ” root.key β†’ keep secret βœ” root.crt β†’ upload to Azure


STEP 5️⃣ Upload Root Certificate to Azure

VPN Gateway β†’ Point-to-site β†’ Root certificates
Field Value
Name root-cert
Public cert data content of root.crt
cat root.crt

Copy entire output (including BEGIN/END).


STEP 6️⃣ Generate Client Certificate

Each laptop must have its own client cert.

Client key

openssl genrsa -out client.key 2048

Client CSR

openssl req -new \
  -key client.key \
  -out client.csr

Sign with root certificate

openssl x509 -req \
  -in client.csr \
  -CA root.crt \
  -CAkey root.key \
  -CAcreateserial \
  -out client.crt \
  -days 365 \
  -sha256

STEP 7️⃣ Install Client Certificate on Laptop

πŸ”Ή Windows

  1. Double-click client.crt
  2. Install β†’ Current User
  3. Store β†’ Personal

πŸ”Ή Linux

sudo cp client.crt /etc/ssl/certs/
sudo cp client.key /etc/ssl/private/

πŸ”Ή macOS

  • Import into Keychain Access
  • Mark as trusted

STEP 8️⃣ Save P2S Configuration

Now go back to Azure Portal and Save P2S config.

⏳ Takes ~5 minutes


STEP 9️⃣ Download VPN Client

VPN Gateway β†’ Point-to-site β†’ Download VPN client

This gives:

  • Windows installer
  • OpenVPN config for Linux/macOS

STEP πŸ”Ÿ Connect to VPN

πŸ”Ή Windows

  • Open Azure VPN Client
  • Click Connect

πŸ”Ή Linux

sudo openvpn --config azurevpnconfig.ovpn

πŸ”Ή macOS

  • Import .ovpn into Tunnelblick / Viscosity

STEP 1️⃣1️⃣ Validate VPN Connection (CRITICAL)

βœ” Check client IP

ip addr   # Linux
ipconfig  # Windows

Expected:

172.16.201.x

βœ” Test private VM access

ping 10.0.1.4
ssh user@10.0.1.4

βœ” Works = VPN successful ❌ Fails = routing / NSG issue


βœ” Check Azure Effective Routes

VM β†’ Networking β†’ Effective routes

You should see:

172.16.201.0/24 β†’ Virtual network gateway

πŸ” Security Best Practices

Rule Why
Use OpenVPN only Secure & flexible
Rotate client certs Prevent abuse
Disable unused certs Least privilege
Use Azure AD auth Enterprise-grade
Combine with Private Endpoint Zero Trust

🧠 Common Problems & Fixes

Issue Cause Fix
VPN connects but no access NSG blocks Allow VNet CIDR
DNS not resolving No private DNS Configure DNS
Overlapping CIDR Bad IP plan Redesign ranges
Client cert rejected Wrong root cert Re-upload

🏁 Final Mental Model

Root Certificate   β†’ Trust authority
Client Certificate β†’ User identity
P2S Pool           β†’ Client IPs
VPN Gateway        β†’ Entry point
VNet               β†’ Private resources