Lesson 3 of 4 Private and Remote Connectivity

Securing VPN Connections

This lesson explains how to secure site-to-site and point-to-site connections.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe custom IPsec and IKE policies.
  • Identify the rules that apply to a policy.
  • Compare point-to-site authentication options.
  • Explain the requirements for Microsoft Entra authentication.

VPN gateway basics

An Azure VPN gateway sends encrypted traffic between a virtual network and another location. A site-to-site (S2S) connection joins a network through an IPsec tunnel. A point-to-site (P2S) connection joins individual client devices. A gateway sits in a subnet that is named GatewaySubnet, and its SKU decides throughput and features. The Basic SKU lacks several features discussed here, including Microsoft Entra authentication and custom IPsec policies. Route-based gateways are needed for almost everything, as policy-based gateways are limited. New gateways use zone-redundant SKUs.

Encryption protects data in transit, but the tunnel's strength depends on its algorithms, and an authenticated tunnel with weak users is still weak. Both halves need attention.

Custom IPsec and IKE policies

Without a custom policy, Azure and the on-premises device negotiate from a default list that aims for compatibility, and that may include weaker options. A custom IPsec/IKE policy states exactly what is allowed, which suits compliance requirements. A policy has the following parts.

PhaseSettingsRecommended examples
IKE (phase 1)Encryption, integrity and Diffie-Hellman groupAES256 or GCMAES256, SHA384, DHGroup24 or ECP384
IPsec (phase 2)Encryption, integrity and PFS groupGCMAES256, GCMAES256, PFS24 or ECP384
LifetimesQuick mode SA lifetime in seconds and kilobytesDefault 27,000 seconds

Several rules apply. A policy is set per connection, and one connection can have one policy. It applies only to S2S and VNet-to-VNet connections, not to P2S. All algorithms must be specified, as a partial policy is not allowed. When GCMAES is the IPsec encryption, the same GCMAES algorithm and key length must be the integrity choice. The on-premises device must match, or the tunnel does not establish. IKE main mode lifetime is fixed at 28,800 seconds. The feature is available on VpnGw1 to VpnGw5 and their zone-redundant equivalents, and not on Basic.

Avoid DES, 3DES, MD5, SHA1, and Diffie-Hellman groups 1 and 2, which are kept only for compatibility. The dead peer detection timeout defaults to 45 seconds, and Microsoft recommends a value between 30 and 45.

az network vpn-connection ipsec-policy add --resource-group RG --connection-name S2S \
  --ike-encryption AES256 --ike-integrity SHA384 --dh-group DHGroup24 \
  --ipsec-encryption GCMAES256 --ipsec-integrity GCMAES256 --pfs-group PFS24 \
  --sa-lifetime 27000 --sa-max-size 102400000
True or false

Custom IPsec/IKE policies

Exam skills 2.3.4

Check the rules for custom IPsec and IKE policies.

Log in to try this activity Interactive activities are free with an account.

Point-to-site authentication

P2S offers three authentication methods, and they differ a great deal in security.

Certificate
Identity sourceClient certificates
MFA and Conditional AccessNo
Tunnel typeIKEv2, SSTP or OpenVPN
RevocationA revocation list on the gateway
RADIUS
Identity sourceAn existing RADIUS server
MFA and Conditional AccessDepends on the server
Tunnel typeIKEv2, SSTP or OpenVPN
RevocationOn the RADIUS server
Microsoft Entra ID
Identity sourceMicrosoft Entra accounts
MFA and Conditional AccessYes
Tunnel typeOpenVPN only
RevocationDisable the account, or a policy

Microsoft Entra authentication is the best choice in most cases, as it brings Conditional Access and MFA to VPN sign-ins. It needs the OpenVPN (SSL) tunnel type, and a gateway other than Basic or policy-based. It uses the Azure VPN Client on Windows 11 or macOS. The preview client for Linux was retired on 31 August 2026.

The configuration needs a tenant URL, an issuer of the form https://sts.windows.net/{Tenant ID}/ with its trailing slash, and an audience. For new deployments, use the Microsoft-registered audience. Manually registered clients retire on 31 March 2028 in Azure public cloud. A gateway supports one audience value, and a custom audience is also possible. A Conditional Access policy then targets the Azure VPN application.

Sort into groups

P2S authentication methods

Exam skills 2.3.4

Decide which point-to-site authentication method each statement describes.

Log in to try this activity Interactive activities are free with an account.

Other protections

A few further considerations round out VPN security. Use a long, random pre-shared key for S2S, and store it safely; a shared key is not rotated automatically. Split tunnelling decides whether clients send all traffic through the VPN, which is a trade-off between visibility and performance. An NSG cannot be associated in a helpful way with GatewaySubnet, and adding one can break the gateway, so filter traffic in workload subnets. Send gateway logs to a workspace for tunnel and P2S diagnostics, and use VPN troubleshoot for faults. For private connections, ExpressRoute does not encrypt traffic by default, so use MACsec or an IPsec tunnel over it if the requirement demands encryption.

Scenario questions

Other VPN protections

Exam skills 2.3.4

Apply the remaining VPN security practices.

Log in to try this activity Interactive activities are free with an account.
Worked example

Meeting a cryptographic requirement

An auditor requires that a site-to-site VPN uses AES-256 with perfect forward secrecy, and that remote administrators connect with MFA, using no certificates. The gateway is VpnGw2AZ. What should you do?

Add a custom IPsec/IKE policy to the S2S connection, with AES256 or GCMAES256, a suitable DH group and a PFS group such as PFS24, and configure the on-premises device to match. For administrators, set P2S to the OpenVPN tunnel type with Microsoft Entra ID authentication, and require MFA with a Conditional Access policy.

Setting a policy on the gateway alone is not possible, because it attaches to a connection. Certificate authentication fails the no-certificates requirement and offers no MFA. A partial policy that names only encryption is not allowed.

Check yourself

Can a custom IPsec/IKE policy be applied to a point-to-site configuration?

Show answer

No. It applies to site-to-site and VNet-to-VNet connections.

Exam Tips

Remember for the exam

  • A custom IPsec policy is per connection, and it is for S2S and VNet-to-VNet only.
  • All algorithms must be specified, or the policy is rejected.
  • Entra P2S needs OpenVPN, and it brings MFA and Conditional Access.
  • ExpressRoute is private, but it is not encrypted by default.