Configure a point-to-site VPN on Linux for Azure Files
Hereβs a concise, GitBook-optimized summary of the article, preserving structure and links.
Overview / When to use P2S
P2S is a VPN between Azure and an individual client. Use it to mount Azure file shares from an on-premises machine.
If many on-premises clients need access, consider a Site-to-Site (S2S) VPN instead: https://docs.azure.cn/en-us/storage/files/storage-files-configure-s2s-vpn.
Recommended reading before starting: Azure Files networking overview: https://docs.azure.cn/en-us/storage/files/storage-files-networking-overview
Prerequisites
Latest Azure CLI (or Azure PowerShell if preferred). Install instructions: https://learn.microsoft.com/cli/azure/install-azure-cli
An Azure file share and storage account. Create: https://docs.azure.cn/en-us/storage/files/storage-how-to-create-file-share
A private endpoint for the storage account: https://docs.azure.cn/en-us/storage/files/storage-files-networking-endpoints?tabs=azure-cli
Install required software on Linux
strongSwan (IPsec) is used in the example. Example commands (Ubuntu verified):
sudo apt update
sudo apt install strongswan strongswan-pki libstrongswan-extra-plugins curl libxml2-utils cifs-utils unzip
If you see EAP_IDENTITY errors, install extra plugins:
sudo apt install -y libcharon-extra-plugins
Create certificates for VPN authentication
Create a root certificate (uploaded to the virtual network gateway) and a client certificate signed by that root.
The article includes an ipsec/openssl script that produces:
rootCert.pem (converted to base64 for gateway)
client.p12 (client certificate bundle)
Example variables shown: ROOT_CERT_NAME, USERNAME, PASSWORD.
Deploy the virtual network gateway
Gateway requires:
A public IP to identify the gateway.
The root certificate public data uploaded to the gateway.
Note: deployment can take up to ~45 minutes.
P2S IKEv2/OpenVPN requires a non-Basic SKU (example uses VpnGw1).
The article includes az CLI commands to create the public IP, gateway, and upload the root cert.
Configure the VPN client on Linux
Download the gateway's VPN client package (the gateway provides a download link).
Place the generated certificates in the correct strongSwan directories and update ipsec.conf and ipsec.secrets with values from the downloaded config.
Restart strongSwan and bring up the connection (the article provides the exact commands and xml parsing steps).
See also:
Azure Files networking overview: https://docs.azure.cn/en-us/storage/files/storage-files-networking-overview
Configure P2S VPN on Windows for Azure Files: https://docs.azure.cn/en-us/storage/files/storage-files-configure-p2s-vpn-windows
Configure S2S VPN for use with Azure Files: https://docs.azure.cn/en-us/storage/files/storage-files-configure-s2s-vpn
Last updated: 09/30/2025
If you want, I can extract the exact CLI scripts as a single ready-to-run snippet or produce a shortened checklist for quick execution. Which would you prefer?
Was this helpful?