Forum Discussion

PaulCollinge's avatar
PaulCollinge
Icon for Microsoft rankMicrosoft
Jun 27, 2022

Optimizing RDP Connectivity for Windows 365

Updated with RDP & Zscaler connectivity improvements February 2025

The use of VPN or Secure Web Gateway (SWG) client software or agents to provide tunneled access to on-premises resources in addition to providing protected internet access via a cloud based Secure Web Gateway (SWG) or a legacy VPN & on-premises proxy path is very commonly seen in Windows 365 and AVD deployments. This is especially the case when deployed in the recommended Windows 365 with Microsoft Hosted Network (MHN) model where the Cloud PC is located on a network with direct, open high-speed internet available. The more modern, cloud based SWG solutions fit perfectly with this modern Zero-Trust approach and generally perform at a higher level than traditional VPN software, where internet browsing is hairpinned through on-premises proxies and back out to the internet.

As we have many Windows 365 customers using such solutions as part of their deployment, there are some specific configuration guidelines which are outlined in this post which Microsoft recommends are applied to optimize key traffic and provide the highest levels of user experience. 

 

What is the Problem?

 

Many of these VPN/SWG solutions build a tunnel in the user context, which means that when a user logs in to their device, the service starts and creates the tunnels required to provide both internet and private access as defined for that user. With a physical device the tunnel is normally up and running before or shortly after the user sees their desktop on screen, meaning they can then quickly get on with their work without noticing its presence.

However, as with any virtualized device which needs a remote connection to access, the above model poses several challenges:

 

1. Additional Latency

Firstly, the remote desktop traffic is latency sensitive, in that delay to the traffic reaching its destination can easily translate into a poor user experience, with lag on actions and desktop display. Routing this traffic through a tunnel to an intermediary device to reach its destination adds latency and can restrict throughput regardless of how well configured or performing said device is. Modern SWG solutions tend to perform at a much higher levels than a traditional VPN/Proxy approach, but the highest level of experience is always achieved through a direct connection and avoiding any inspection or intermediary devices. Much like Teams media traffic, the RDP traffic in the Windows 365 case should be routed via the most optimal path between the two endpoints so as to deliver the very highest levels of performance, this is almost always the direct path via the nearest network egress. From a Cloud PC side this also means the traffic never leaves Microsoft’s managed network if directly egressed. 

 

2. RDP Connection Drops

An additional challenge comes from the use of user-based tunnels. As the user initiates a connection to the Cloud PC, the connection reaches the session host without issue and the user successfully sees the initial logon screen. However, once the user login starts, and the client software then builds the tunnels to the SWG/VPN for the user, the user then experiences a freeze of the login screen. The connection then drops, and we have to go through the reconnection process to re-establish the connection to the Cloud PC. Once this is complete, the user can successfully use the Cloud PC without further issue. Users however may also experience disconnects of the remote session if there is any issue with the tunnel, for example if the tunnel temporarily drops for some reason. Overall, this doesn’t provide a great user experience with the Cloud PC, especially on initial login.

  

Why does this occur?

 

It occurs because the tunnels built to route internet traffic to the SWG generally capture all internet bound traffic unless configured not to do so, a forced tunnel or ‘Inverse split tunnel’. This means the initial login works without issue but as soon as this tunnel is established upon user logon, the RDP traffic gets transferred into it and as it’s a new path, requires reconnecting. Equally, as the traffic is inside this tunnel, if the tunnel drops momentarily and needs to reconnect, this also causes the RDP session to require reconnecting inside the re-established tunnel.

In the diagram below, you can see a simplified representation of this indirect connectivity approach with a forced tunnel in place. RDP traffic has to traverse the VPN/SWG resources before hitting the gateway handling the traffic. Whilst this is not a problem for less sensitive traffic and general web browsing, for latency critical traffic such as Teams and the RDP traffic, it is non-optimal.

 

 

What’s the Solution?

 

Microsoft strongly recommends implementing a forced tunnel exception for the critical RDP traffic which means that it does not enter the tunnel to the SWG or VPN gateway and is instead directly routed to its destination. This solves both of the above problems by providing a direct path for the RDP traffic and also ensuring it isn’t impacted by changes in the tunnel state. This is the same model as used by specific ‘Optimize’ marked  Office 365 traffic such as Teams media traffic. On the Cloud PC side this also means this traffic never leaves Microsoft’s managed network.

 

What exactly do I need to bypass from these tunnels?

Previously, solving this problem meant significant complexity due to the large number of IP addresses required to configure optimization for this RDP traffic, we provided a script as part of this blog to assist with collecting and formatting these IPs. I'm pleased to share that Microsoft has invested in an extensive and complex piece of work to solve this challenge by building a new, upgraded global gateway infrastructure to allow it to be addressed from a single subnet. In addition to that simplification that we have planned so that this subnet should not see any regular change, abstracting customers from change as we scale the infrastructure and add new regions in future. 

As of February 2025, this work has now been completed and the old infrastructure decommissioned, this was all completed with zero downtime for our customers. This now allows RDP based traffic to now be covered by two single subnets rather than many hundred as previously was the case.

There are further improvement works due to be delivered in the coming months for UDP based RDP to provide new dedicated and globally scaled TURN infrastructure. This post will be updated when this is complete and RDP connectivity is therefore in its final and complete, simplified and secured state. These temporary elements are:

  1. The WindowsVirtualDesktop service tag Is now up to date as of 19th March 2025 which all decommissioned IPs removed. 

2. UDP based RDP via TURN is currently using the subnet 20.202.0.0/16 but will switch to 51.5.0.0/16 in H1 CY25. The new, dedicated subnet is in the WindowsVirtualDesktop service tag but the current one (20.202.0.0/16) is not, so will manually need to be added to current bypass configuration if desired. More on this can be found in this post. This work will also vastly expand our global TURN relay availability. Today this is only available when the physical device is in the vicinity of these Azure regions.

 

RDP based Connectivity bypass:

As of February 2025, the critical traffic which carries RDP is contained within the following simplified endpoints:

RDP Endpoints for Optimization

Row

Endpoint

Protocol

Port

Purpose

1

*.wvd.microsoft.com

TCP

443

Core TCP based RDP and other critical service traffic

2

40.64.144.0/20

TCP

443

Core TCP based RDP

3

20.202.0.0/16

UDP

3478

Core UDP based RDP via TURN - Current

4

51.5.0.0/16

UDP

3478

Core UDP based RDP via TURN – Future (Currently not in use)

 

Please see this article for more information on rows 3 & 4

In some network equipment/software we can configure bypass using FQDNs and wildcard FQDNs alone, and we’d recommend that this method (row 1) is used in addition to the IP based rules if possible. However, some solutions do not allow the use of wildcard FQDNs so it’s common to see only IP addresses used for this bypass configuration. In this case you can use the newly simplified rows 2 & 3 in the table above, making sure row 1 is still accessible via the SWG/Proxy. We also recommend row 4 is also added to manually configured optimizations to ensure this is also optimized when it comes into use in the coming months.

There are also a small number of other endpoints which should be bypassed on the Cloud PC side. 

 

Other required VPN/SWG bypass requirements:

 

Other endpoints for Optimization 

Row

Endpoint

Protocol

Port

Purpose

5

azkms.core.windows.net

TCP

1688

Azure KMS - Traffic Needs to arrive from Azure public IPs

6

169.254.169.254

TCP

80

Azure Fabric communication

7

168.63.129.16

TCP

80

Azure Fabric communication

 

These additional bypass requirements (5-7) are not RDP related but are required for the following reasons:

  • Row 5 – This is Azure KMS activation which is a required endpoint for a Cloud PC and AVD Session Hosts. The traffic for this needs to arrive from an Azure public IP, if not then the connection will not be successful. Therefore it should not be sent via a 3rd party internet egress such as via an SWG or proxy. IP addresses corresponding to the FQDN can be found via the link above if required.

 

 

How do I implement the RDP bypass in common VPN/SWG solutions?

Microsoft is working with several partners in this space to provide bespoke guidance and we’ll add detailed guidance for other solutions here as we get them confirmed. Already available however is Zscaler ZIA.

 

Zscaler Client Connector

The changes outlined above should make configuration in all scenarios vastly simpler moving forward. 

Due to some fantastic work to assist our mutual customers by our friends at Zscaler, as of February 2025 and version 4.3.2 of the Zscaler Client Connector, the majority of the mentioned Windows 365 and AVD traffic which requires optimization, including RDP can be bypassed with a single click configuration within a predefined IP based bypass!  

 

Zscaler ZIA Configuration

  1. Version 4.3.2 (Released Feb 2025) of the Zscaler Connector Client portal enables this feature. Ensure a recent version of the Client Connector is installed on both the Cloud PC (And Physical device if Zscaler is used there) to take advantage.
  2. In the Zscaler Client Connector Portal, select the new IP-Based, Predefined Application Bypass for Windows 365 & Azure Virtual Desktop. This contains preconfigured bypass for RDP and KMS traffic.
Zscaler IP-Based predefined Application bypass

3. Add the following endpoints to the bypass configuration manually as they are not included in the automatic bypass. As noted above, 20.202.0.0/16 will become unnecessary in a few months and will be removed from this document when decommissioned. It’s replacement (51.5.0.0/16) is already included in the preconfigured bypass.

 

Endpoint

Protocol

Port

Purpose

20.202.0.0/16

UDP

3478

Core UDP based RDP via TURN - Current

169.254.169.254

TCP

80

Azure Fabric communication

168.63.129.16

TCP

80

Azure Fabric communication

 

Other VPN/SWG solutions

Microsoft is currently working with other partners in this space to provide detailed guidance for other VPN/SWG solutions and will list them here as they are complete. Please let us know in the comments if you’d like us to list a particular solution and we’ll aim to prioritize based on feedback.

In the interim, use rows 1-7 in the tables above to create manual bypasses from VPN/SWG/Proxy tunnels. This should be significantly simpler and have much lower change rates than previously due to the IP consolidation.

 

FAQs:

Q: In a Microsoft Hosted Network deployment, is there anything else I need to do?

A: Unless the local Windows firewall is configured to block access to the endpoints noted, there should be nothing else required, the network the virtual NIC sits in has direct, high speed connectivity Microsoft’s backbone and the internet.

 

Q: In an Azure Network Connection scenario, is there anything further I need to do?

A: In this scenario, the recommended path for the traffic is directly out of the VNet into Microsoft’s backbone. Depending on the configuration it may require allowing the endpoints noted in this article through a firewall or NSG. The WindowsVirtualDesktop service tag or FQDN tag may help with automating rules in firewalls or configuring User Defined Routing. RDP traffic specifically should be sent direct into Microsoft’s backbone via a NAT Gateway or similar with no TLS inspection, avoiding putting load on NVAs such as Firewalls. 

 

Q: Do I need to configure the bypass on just the Cloud PC?

A: RDP connectivity (Rows 1-4) is used identically on both the physical and cloud sides. It is strongly advised that the bypass is applied to both the Cloud PC and the connecting client if that also uses the SWG/VPN to connect. If both are using the same configuration profile then this should happen automatically. Rows 5-7 are only required on the cloud side. 

 

Q: How often do the IP addresses Change?

A: Now the improvement work is complete we don’t anticipate regular change. You can monitor the WindowsVirtualDesktop service tag for changes if desired and we’re working on getting these requirements into the M365 Web Service longer term for monitoring and automation.

 

Q: Can I add more than the RDP traffic to the bypass.

A: Microsoft only provides IP addresses for the RDP connectivity at present. However if your solution is capable of configuration by FQDN alone, then you can add other service endpoints to your optimized path, these can be found on this Microsoft docs page.

 

Q: Im using a true split tunnel, does this impact me?

A: The above advice is for a forced tunnel scenario (inverse split tunnel) where the default path is via the tunnel and only defined exceptions are sent direct, which is often referred to as a split tunnel in common parlance and is the most commonly seen deployment model of such solutions. However a split tunnel in the technically accurate sense of the words, where the default path is the internet and only defined endpoints (such as corp server ranges/names) are sent down the tunnel, shouldn’t need such configuration as the RDP traffic should follow the default path to the internet.

 

Q: Does this also optimize RDP shortpath?

A: RDP Shortpath for Public Networks works to provide a UDP based RDP connection between the client and Cloud PC if enabled and achievable. This connection is in addition to the TCP based connection described above and the dynamic virtual channels such as graphics, input etc are switched into the UDP connection if deemed optimal. Rows 3 & 4 above cover this traffic for connectivity via TURN relays. Please see this article for more information on this connectivity model. 

Q: Is this advice also shared in Microsoft’s official documentation?

 A: We’re currently working on uplifting the entire connectivity documentation for Windows 365 and the above will form part of this work in the coming months. We’ll share the official link in this blog when available.

 

Q: Does this advice apply equally to AVD?

A: Yes, both Windows 365 and AVD have exactly the same requirements in terms of the connectivity discussed in this blog.

19 Replies

  • UmairK's avatar
    UmairK
    Copper Contributor

    We use ZIA and have setup the config using IP-Based, Predefined Application bypass for Windows 365 & Azure Virtual Desktop and added the following IPs in the IPv4 Inclusion list but we continue to get the disconnects at login

    20.202.0.0/16

    169.254.169.254

    168.63.129.16

    The Zscaler client version is 4.5.0.352. Do these IPs above need to go in the IPv4 inclusion or the IPv4 exclusion list?

    • MarcoS81's avatar
      MarcoS81
      Copper Contributor

      Same issue! We use ZCC 4.5.0.352 installed with Strict Enforcement + default policy and AVD is from a Trusted network with TV1.0. We tried also to put on both AppProfile pac file and Forwarding pac file -return DIRECT- but we still facing the disconnection issue when ZCC switch to -signed in-

    • PaulCollinge's avatar
      PaulCollinge
      Icon for Microsoft rankMicrosoft

      They need to be bypassed from the Ztunnel. However, if using Tunnel V1 you should be able to bypass *.wvd.microsoft.com and the subnets you list above in the PAC file. 

    • WATKINS11400's avatar
      WATKINS11400
      Copper Contributor

      In your app profile, you need to put them in. "Hostname or IP Address Bypass for VPN Gateway".  I assume you're using Ztunnel2 configuration ?

  • HMS-Vik's avatar
    HMS-Vik
    Copper Contributor

    PaulCollinge - For those using Firewall Management on Zscaler and blocking WebSocket by default (as per best practices) we had to add ".wvd.microsoft.com" to the Allowlist under firewall management in ZIA.  This prevented random disconnects during the reauthorization process and Teams calls.

     

    Note, an asterisk is not necessary as Zscaler assumes everything left of the initial "." is included.

  • SanjayP2280's avatar
    SanjayP2280
    Copper Contributor

    PaulCollinge we are trying to get Cisco Anyconnect to work with RDP/Windows 365 Cloud PC.  Can you provide any guidance on how to get Cisco Anyconnect VPN to work in this setup?  We tried Split tunneling with  wvd.microsoft.com excluded from the tunnel; however that did not work.  The VPN session tries to establish and then drops the RDP and subsequently the VPN session.

    • PaulCollinge's avatar
      PaulCollinge
      Icon for Microsoft rankMicrosoft

      SanjayP2280 

       

      The FQDN to offload should be *.wvd.microsoft.com. 

      Alternatively use the IPs outlined in the article, this should work seamlessly. We're working on reducing the subnet count down to two subnets and this work should complete in the coming months.

       

      Paul

  • abbassaqib450's avatar
    abbassaqib450
    Copper Contributor
    Using VPN or Secure Web Gateway (SWG) client software is a solid approach for secure, tunneled access to on-premises resources. By combining a cloud-based SWG for protected internet access with legacy VPN and on-premises proxy, you ensure both internal and external traffic are secure. This hybrid model offers flexibility and strong security, but make sure the performance impact is minimal, especially for cloud-based resources.
  • WATKINS11400's avatar
    WATKINS11400
    Copper Contributor

    Just to clarify, as this seems fairly confusing.  If you are using Zscaler ZIA, and you're using Ztunnel1 mode, i.e. HTTP/S proxy, you can add Pac file entries to bypass Zscaler for the wildcard URLs mentioned. 

    If however you're using Ztunnel2 ( aka All ports ) you cannot use the Pac file solution, the IP addresses (385 currently) need to be maintained in the App Profile the user is assigned.

    • PaulCollinge's avatar
      PaulCollinge
      Icon for Microsoft rankMicrosoft
      Correct, using tunnel1 you can use a PAC file to make the adjustment. Given Zscaler's recommendation is for tunnel2 then this is what we focus on above. The IP subnets should come down to just two within the coming months making this easier to configure.
  • mmmiller60's avatar
    mmmiller60
    Copper Contributor

    PaulCollingeis there no way to achieve this with only URLs instead of having the quality of our enterprise VDI environment reliant on an IP list that is regularly changing and needs maintained monthly like a pet?

    • PaulCollinge's avatar
      PaulCollinge
      Icon for Microsoft rankMicrosoft
      Hi,
      The answer depends on the solution you're using, some VPN/SWG software allows configuration using wildcard FQDNs, where that's possible you can use *.wvd.microsoft.com. Others don't support wildcard FQDNs so you'll have to use the IP list. We're working on consolidating the IP space into a small number of subnets which won't change regularly which will resolve this particular challenge, however that will take some considerable time to complete.
      • mmmiller60's avatar
        mmmiller60
        Copper Contributor

        PaulCollingeThank you so much for the speedy response and the clarification!  Apologies, it was not clear for me from the article that either the IP's OR the URL are used, but both are not needed.  We are using zscaler so URLs are supported (step #b confused me since it mentioned using the IPs, but I guess that was included for informational purposes and is not required).  When we create an exclusion for *.wvd.microsoft.com do we also still need to exclude 169. 254.169.254 and 168.63.129.16 or does that URL cover them as well?
        If we do still exclude those 2 IPs, is there any potential for them to ever change?

Resources