Configure an Always-On VPN user tunnel - Azure VPN Gateway (2024)

  • Article

The Always On feature was introduced in the Windows 10 VPN client. Always On is the ability to maintain a VPN connection. With Always On, the active VPN profile can connect automatically and remain connected based on triggers, such as user sign-in, network state change, or device screen active.

You can use gateways with Always On to establish persistent user tunnels and device tunnels to Azure.

Always On VPN connections include either of two types of tunnels:

Device tunnels and user tunnels operate independent of their VPN profiles. They can be connected at the same time, and they can use different authentication methods and other VPN configuration settings, as appropriate.

This article helps you configure an Always On VPN user tunnel. For information about configuring a device tunnel, see Configure an Always On VPN device tunnel.

Configure the gateway

Use the instructions in the Configure a Point-to-Site VPN connection article to configure the VPN gateway to use IKEv2 and certificate-based authentication.

Configure a user tunnel

  1. Install client certificates on the Windows client, as shown in this point-to-site VPN client article. The certificate must be in the current user store.

  2. You can configure the Always On VPN client through PowerShell, Configuration Manager, or Intune by following the instructions in Configure Windows 10 or later client Always On VPN connections.

Example configuration for the user tunnel

After you've configured the virtual network gateway and installed the client certificate in the local machine store on the Windows client, configure a client device tunnel by using the following examples. Note that these examples have been validated on Windows 10.

  1. Copy the following text, and save it as usercert.ps1:

    Param([string]$xmlFilePath,[string]$ProfileName)$a = Test-Path $xmlFilePathecho $a$ProfileXML = Get-Content $xmlFilePathecho $XML$ProfileNameEscaped = $ProfileName -replace ' ', '%20'$Version = 201606090004$ProfileXML = $ProfileXML -replace '<', '&lt;'$ProfileXML = $ProfileXML -replace '>', '&gt;'$ProfileXML = $ProfileXML -replace '"', '&quot;'$nodeCSPURI = './Vendor/MSFT/VPNv2'$namespaceName = "root\cimv2\mdm\dmmap"$className = "MDM_VPNv2_01"$session = New-CimSessiontry{$newInstance = New-Object Microsoft.Management.Infrastructure.CimInstance $className, $namespaceName$property = [Microsoft.Management.Infrastructure.CimProperty]::Create("ParentID", "$nodeCSPURI", 'String', 'Key')$newInstance.CimInstanceProperties.Add($property)$property = [Microsoft.Management.Infrastructure.CimProperty]::Create("InstanceID", "$ProfileNameEscaped", 'String', 'Key')$newInstance.CimInstanceProperties.Add($property)$property = [Microsoft.Management.Infrastructure.CimProperty]::Create("ProfileXML", "$ProfileXML", 'String', 'Property')$newInstance.CimInstanceProperties.Add($property)$session.CreateInstance($namespaceName, $newInstance)$Message = "Created $ProfileName profile."Write-Host "$Message"}catch [Exception]{$Message = "Unable to create $ProfileName profile: $_"Write-Host "$Message"exit}$Message = "Complete."Write-Host "$Message"
  2. Copy the following text, and save it as VPNProfile.xml in the same folder as usercert.ps1. Edit the following text to match your environment:

    • <Servers>azuregateway-1234-56-78dc.cloudapp.net</Servers> <= Can be found in the VpnSettings.xml in the downloaded profile zip file
    • <Address>192.168.3.5</Address> <= IP of resource in the vnet or the vnet address space
    • <Address>192.168.3.4</Address> <= IP of resource in the vnet or the vnet address space
    • <PrefixSize>32</PrefixSize> <= Subnet mask
     <VPNProfile> <NativeProfile> <Servers>azuregateway-b115055e-0882-49bc-a9b9-7de45cba12c0-8e6946892333.vpn.azure.com</Servers> <NativeProtocolType>IKEv2</NativeProtocolType> <Authentication> <UserMethod>Eap</UserMethod> <Eap> <Configuration> <EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig"><EapMethod><Type xmlns="http://www.microsoft.com/provisioning/EapCommon">13</Type><VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId><VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType><AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</AuthorId></EapMethod><Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"><Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"><Type>13</Type><EapType xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1"><CredentialsSource><CertificateStore><SimpleCertSelection>true</SimpleCertSelection></CertificateStore></CredentialsSource><ServerValidation><DisableUserPromptForServerValidation>false</DisableUserPromptForServerValidation><ServerNames></ServerNames></ServerValidation><DifferentUsername>false</DifferentUsername><PerformServerValidation xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2">false</PerformServerValidation><AcceptServerName xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2">false</AcceptServerName></EapType></Eap></Config></EapHostConfig> </Configuration> </Eap> </Authentication> <RoutingPolicyType>SplitTunnel</RoutingPolicyType> <!-- disable the addition of a class based route for the assigned IP address on the VPN interface --> <DisableClassBasedDefaultRoute>true</DisableClassBasedDefaultRoute> </NativeProfile> <!-- use host routes(/32) to prevent routing conflicts --> <Route> <Address>192.168.3.5</Address> <PrefixSize>32</PrefixSize> </Route> <Route> <Address>192.168.3.4</Address> <PrefixSize>32</PrefixSize> </Route> <!-- traffic filters for the routes specified above so that only this traffic can go over the device tunnel --> <TrafficFilter> <RemoteAddressRanges>192.168.3.4, 192.168.3.5</RemoteAddressRanges> </TrafficFilter> <!-- need to specify always on = true --> <AlwaysOn>true</AlwaysOn> <RememberCredentials>true</RememberCredentials> <!--new node to register client IP address in DNS to enable manage out --> <RegisterDNS>true</RegisterDNS> </VPNProfile>
  3. Run PowerShell as an administrator.

  4. In PowerShell, switch to the folder where usercert.ps1 and VPNProfile.xml are located, and run the following command:

    C:\> .\usercert.ps1 .\VPNProfile.xml UserTest

    Configure an Always-On VPN user tunnel - Azure VPN Gateway (1)

  5. Under VPN Settings, look for the UserTest entry, and then select Connect.

  6. If the connection succeeds, you've successfully configured an Always On user tunnel.

To remove a profile

To remove a profile, use the following steps:

  1. Run the following command:

    C:\> Remove-VpnConnection UserTest 
  2. Disconnect the connection, and clear the Connect automatically check box.

    Configure an Always-On VPN user tunnel - Azure VPN Gateway (2)

Next steps

To troubleshoot any connection issues that might occur, see Azure point-to-site connection problems.

Configure an Always-On VPN user tunnel - Azure VPN Gateway (2024)

FAQs

Is always on VPN supported in Azure? ›

You can use gateways with Always On to establish persistent user tunnels and device tunnels to Azure. Always On VPN connections include either of two types of tunnels: Device tunnel: Connects to specified VPN servers before users sign in to the device.

What is the difference between always on VPN device and user tunnel? ›

Always On VPN connections include two types of tunnels: Device tunnel connects to specified VPN servers before users log on to the device. Pre-login connectivity scenarios and device management purposes use device tunnel. User tunnel connects only after a user logs on to the device.

Why is always on VPN user tunnel not connecting? ›

If your Always On Virtual Private Network (VPN) setup isn't connecting clients to your internal network, you may have encountered one of the following issues: The VPN certificate is invalid. The Network Policy Server (NPS) policies are incorrect. Issues with client deployment scripts or Routing and Remote Access.

What are the prerequisites for always on VPN device tunnel? ›

The device must be a domain joined computer running Windows 10 Enterprise or Education version 1809 or later. The tunnel is only configurable for the Windows built-in VPN solution and is established using IKEv2 with computer certificate authentication. Only one device tunnel can be configured per device.

What is the difference between VPN server and VPN gateway? ›

A VPN Client is used to search for the access provided by the VPN Gateway in order to establish a connection, building a secure tunnel to traffic data of users and corporations. In simplified language, it is a “client-server” structure (VPN Gateway is the server and VPN Client is the client).

What are the disadvantages of always on VPN? ›

AO VPN works only with Windows 10. It is not supported for Windows 7 or other operating systems. While AO VPN does add extensive filtering options, no additional blocking technologies exist to prevent viruses or malware, such as crypto locker, from encrypting files.

Why should you not always use a VPN? ›

While people sometimes use VPNs to bypass geo restrictions or for malicious deeds, some websites block access if a user's VPN is on. In such cases, disabling a VPN might be necessary. Avoiding software conflicts. Some applications or services, such as online games or streaming services, may clash with a VPN.

Is always on VPN better than direct access? ›

Microsoft positions Always On VPN as a better alternative to DirectAccess and recommends the use of Always On VPN whenever possible. However, Always On VPN requires clients to run Windows 10 or higher, which might not be an option in environments that need to support older Windows OSes or non-Windows clients.

What is always tunnel VPN? ›

January 8, 2024. The AlwaysOn VPN before Windows Logon (formally Always On service) feature enables a user to establish a machine level VPN tunnel even before a user logs in to a Windows system. The tunnel remains active until the machine shuts down.

What port does always on VPN use? ›

IKEv2 can automatically restore connectivity if there is an interruption in network connectivity. But a disadvantage of IKEv2 is that it might be blocked by firewalls. VPN clients need outbound access on UDP ports 500 and 4500.

Why am I unable to connect to VPN tunnel? ›

Try to restart or reinstall your VPN extension for Chrome, Firefox, Edge, Opera, or other browser. Additionally, you can check if your chosen VPN provider offers limited features for its extensions. You can also check if you have the latest browser extension version or your browser's security settings.

What is the benefit of always on VPN? ›

Always On VPNs allow IT administrators to set granular routing policies from users to the application level. This helps secure access to critical business applications that require special remote access.

Is always on VPN non domain joined? ›

Always On VPN provides a single, cohesive solution for remote access and supports domain-joined, non-domain-joined (workgroup), or Azure Active Directory (AD)-joined devices, even personally owned devices.

What protocol does always on VPN use? ›

It uses Windows 10's built-in VPN client and the Internet Key Exchange version 2 protocol. IKEv2 is a reliable and secure protocol that provides robust authentication and encryption standards, making it a viable choice for Always On VPN.

What type of VPN is always on? ›

Always On VPNs use the default Windows 10 built-in Extensible Authentication Protocol (EAP) for secure authentication via username and password or certificate-based login methods. EAP-based authentication can be used only with a built-in VPN type such as IKEv2, L2TP, PPTP or Automatic.

What is always on in Azure App Service? ›

Always On keeps your websites/web applications loaded even when there's no traffic. This rule resolution is part of the Conformity Security & Compliance tool for Azure. By default, websites and web applications are unloaded if they have been idle for too long and this behavior is often undesired.

Does Azure have a VPN service? ›

Azure VPN Gateway connects your on-premises networks to Azure through Site-to-Site VPNs in a similar way that you set up and connect to a remote branch office. The connectivity is secure and uses the industry-standard protocols Internet Protocol Security (IPsec) and Internet Key Exchange (IKE).

Top Articles
Latest Posts
Article information

Author: Van Hayes

Last Updated:

Views: 6244

Rating: 4.6 / 5 (66 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.