π§ What is Point-to-Site (P2S) VPN?¶


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¶
STEP 3οΈβ£ Configure P2S on VPN Gateway (Portal)¶
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¶
Create root certificate¶
β root.key β keep secret
β root.crt β upload to Azure
STEP 5οΈβ£ Upload Root Certificate to Azure¶
| Field | Value |
|---|---|
| Name | root-cert |
| Public cert data | content of root.crt |
Copy entire output (including BEGIN/END).
STEP 6οΈβ£ Generate Client Certificate¶
Each laptop must have its own client cert.
Client key¶
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¶
- Double-click
client.crt - Install β Current User
- Store β Personal
πΉ Linux¶
πΉ 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¶
This gives:
- Windows installer
- OpenVPN config for Linux/macOS
STEP π Connect to VPN¶
πΉ Windows¶
- Open Azure VPN Client
- Click Connect
πΉ Linux¶
πΉ macOS¶
- Import
.ovpninto Tunnelblick / Viscosity
STEP 1οΈβ£1οΈβ£ Validate VPN Connection (CRITICAL)¶
β Check client IP¶
Expected:
β Test private VM access¶
β Works = VPN successful β Fails = routing / NSG issue
β Check Azure Effective Routes¶
You should see:
π 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