Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (2024)

Are you looking to set up an Always-On VPN Tunnel for Client devices using Azure VPN? 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 Azure VPN gateway with Always On to establish persistent user tunnels and device tunnels to Azure. In this article, we will focus on Device Tunnel.

Prerequisite:

1. Configure the point-to-site VPN tunnel using this article Configure P2S server configuration — certificate authentication: Azure portal — Azure VPN Gateway | Microsoft Learn

2. The device must be a domain joined computer running Windows 10 Enterprise or Education version 1809 or later.

3. Only one device tunnel can be configured per device.

Steps to be followed:

Install client certificates on the Windows 10 or later client

Certificate:

  1. Copy the client certificate file into the VPN client device and click to install PFX to install the certificate.
Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (2)

2. Select Store Location as Current User and click on next.

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (3)

Note: After the certificate has been installed with the current user, again install the certificate with the store location as Local Machine

3. Click on Next

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (4)

4. Enter the password for the private key

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (5)

5. Click on Next

6. The certificate has been installed.

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (6)

Install the Azure Point-To-Site VPN on the VPN client device:

  1. Install the VpnClientAmd64.exe package on the client device
  2. Open VPN settings and connect the VPN
Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (7)

3. Click on Connect in the Azure VPN and continue to establish the connection

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (8)

4. Once the VPN Connection has been established, open a command prompt and ping the domain controller IP to test the connectivity.

ping 10.0.0.5 (In my example)

Steps to domain join the VPN client device (Optional)

Note — Here my client is running in Azure and Domain Controller as well. I am joining the client to Domain using P2S VPN first to meet the pre-requisites.

  1. Select Advanced system settings in the Properties of This PC
Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (9)

2. Click on Change and enter the domain name and the logins

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (10)

As you can see the device has joined the domain:

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (11)

Configurations for Device tunnel

We have completed pre-requisutes before, now we will setup Always-On Device Tunnel

1. Copy the following text and save it as devicecert.ps1

Param(
[string]$xmlFilePath,
[string]$ProfileName
)

$a = Test-Path $xmlFilePath
echo $a

$ProfileXML = Get-Content $xmlFilePath

echo $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-CimSession

try
{
$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 devicecert.ps1. Replace 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
  • Update the Route section as per your requirement to ensure proper routing to the VNET CIDRs
<VPNProfile> 
<NativeProfile>
<Servers>azuregateway-1234-56-78dc.cloudapp.net</Servers>
<NativeProtocolType>IKEv2</NativeProtocolType>
<Authentication>
<MachineMethod>Certificate</MachineMethod>
</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>
<!-- need to specify always on = true -->
<AlwaysOn>true</AlwaysOn>
<!-- new node to specify that this is a device tunnel -->
<DeviceTunnel>true</DeviceTunnel>
<!--new node to register client IP address in DNS to enable manage out -->
<RegisterDNS>true</RegisterDNS>
</VPNProfile>

3. Download PsExec (PS Tools) from the below link and extract the files to C:\PSTools.

PSPsExec — Sysinternals | Microsoft Learn

4. Open Command Prompt, change the path where the PS Tools file is present, and execute the below command:

For 32-bit Windows: PsExec.exe -s -i powershell
For 64-bit Windows: PsExec64.exe -s -i powershell
Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (12)

After clicking on the Agree, PowerShell will appear.

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (13)

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

.\devicecert.ps1 .\VPNProfile.xml MachineCertTest
Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (14)

(Note: If facing any issue with policies then Run the below command:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force

4. Now to test the connection, open Run and type rasphone and hit enter

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (15)

5. Look for the MachineCertTest connection entry and click Connect (If you see Hang-up option instead of Connect then you are already connected)

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (16)

6. Remove the earlier created P2S Connection to join the Client Machine to the Domain

I hope this was helpful, thank you for reading! Cheers!

Configure an Always-On VPN device tunnel using Azure VPN on Windows 10 (2024)

FAQs

How to configure always on VPN Azure? ›

To enable Always On VPN, you can use the following steps: Create a VPN profile using the VPNv2 CSP in Intune or another device management tool. Configure the VPN profile with the following settings: <AlwaysOn>true</AlwaysOn> to enable always-on VPN.

How to make VPN always on Windows 10? ›

Create VPN User and Group
  1. On the domain controller, open Active Directory Users and Computers.
  2. Under your domain, right-click Users. Select New. ...
  3. Choose a password for the user.
  4. Deselect User must change password at next logon. Select Password never expires.
  5. Select Finish. Keep Active Directory Users and Computers open.
Mar 14, 2023

How to configure Azure VPN Client in Windows 10? ›

Azure portal
  1. In the Azure portal, go to the virtual network gateway for the virtual network to which you want to connect.
  2. On the virtual network gateway page, select Point-to-site configuration to open the Point-to-site configuration page.
  3. At the top of the Point-to-site configuration page, select Download VPN client.
Mar 20, 2024

What is the difference between always on VPN user and device 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.

How do I make my VPN always on? ›

To force all network traffic through an always-on VPN, follow these steps on the device:
  1. Open your device's Settings app.
  2. Tap Network & internet. Advanced. VPN.
  3. Next to the VPN that you want to change, tap Settings.
  4. Switch Block connections without VPN to on.

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 are the differences between DirectAccess and always on VPN? ›

A benefit of DirectAccess is it enables you to manage clients as though they are local to the network. Always On VPN has a similar feature but with a few improvements to ease device administration. One problem with remote client management is the inability to administer a device if it's not connected to the network.

What are the three required technologies needed before deploying always on VPN? ›

To deploy Always On VPN, you will need to install and configure the following components:
  • A domain controller.
  • Active Directory Group Policy.
  • Network Policy Server (NPS)
  • A VPN server.
Dec 10, 2023

How do I manually setup a VPN in Windows 10? ›

On your taskbar, select the Network, Volume, Battery icon > VPN. From the list of VPN connection names, select the one you want, and then select Connect. If prompted, enter your username and password or other sign in info.

Is Azure VPN split tunnel? ›

The problem is that, by default, Azure P2S VPN is split-tunnel (and I'd prefer to leave it like that), and so, the queries for *. file.core.windows.net are going to go to the locally-configured DNS server (rather than over the VPN to my on-prem DNS servers that have the privatelink zone configured).

Can I use Azure as a VPN? ›

Connect to your Azure virtual networks from anywhere

Point-to-Site VPN lets you connect to your virtual machines on Azure virtual networks from anywhere, whether you are on the road, working from your favorite café, managing your deployment, or doing a demo for your customers.

What is always tunnel VPN? ›

Always On VPN provides connectivity to corporate resources by using tunnel policies that require authentication and encryption until they reach the VPN gateway. By default, the tunnel sessions terminate at the VPN gateway, which also functions as the IKEv2 gateway, providing end-to-edge security.

What is the difference between a tunnel and a VPN? ›

A VPN is a secure, encrypted connection over a publicly shared network. Tunneling is the process by which VPN packets reach their intended destination, which is typically a private network.

What is the difference between always on VPN split tunnel and full tunnel? ›

full tunnel VPN is that a full tunnel VPN shields all your online traffic with VPN encryption, while a split tunnel VPN allows you to divide your traffic, routing a portion of it through a VPN server while the rest of it travels the internet directly.

How do I make my VPN automatic? ›

When a device has multiple profiles with Always On triggers, the user can specify the active profile in Settings > Network & Internet > VPN > <VPN profile> by selecting the Let apps automatically use this VPN connection checkbox. By default, the first MDM-configured profile is marked as Active.

How do I setup an active active VPN on Azure? ›

  1. Sign in to the Azure portal.
  2. In Search resources, service, and docs (G+/) at the top of the portal page, enter virtual network. ...
  3. On the Virtual network page, select Create to open the Create virtual network page.
  4. On the Basics tab, configure the virtual network settings for Project details and Instance details.
Apr 17, 2024

What is always on for VPN? ›

With Always On VPN, your employees can securely access the internet without worrying whether the VPN is on or off, as it will always be enforced, allowing them to focus on their tasks uninterrupted. Your IT admins retain full control over the tool, ensuring secure access and a smooth experience for all.

How to configure open VPN in Azure? ›

First time connecting to the VPN server
  1. Navigate to the Client Web UI in a browser.
  2. Sign in with user credentials.
  3. Choose the OpenVPN Connect app for their operating system.
  4. After it downloads, install the software.
  5. Open the app and click on the connection profile. The user connects to Access Server.

Top Articles
Latest Posts
Article information

Author: Greg Kuvalis

Last Updated:

Views: 5918

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Greg Kuvalis

Birthday: 1996-12-20

Address: 53157 Trantow Inlet, Townemouth, FL 92564-0267

Phone: +68218650356656

Job: IT Representative

Hobby: Knitting, Amateur radio, Skiing, Running, Mountain biking, Slacklining, Electronics

Introduction: My name is Greg Kuvalis, I am a witty, spotless, beautiful, charming, delightful, thankful, beautiful person who loves writing and wants to share my knowledge and understanding with you.