Building A Highly Available Remote Desktop Gateway Farm integrated with Azure MFA

Build High Available Remote Desktop Gateway integrated with Azure MFA

Implemented parts

The following parts have been implemented:

  • On-Premises Infrastructure
  1. Microsoft Windows Server 2016 Standard Edition (3 Servers)
  2. A Highly Available Load Balanced RD Gateway Server Farm (RDG).
  3. Network Policy Server (Centralized NPS).
  • Enterprise Mobility + Security E3
  1. Microsoft Azure Multi-Factor Authentication

Solution Requirements

Prerequisites

  • Remote Desktop Gateway (RD Gateway) infrastructure
  • Azure MFA License
  • Windows Server software
  • Network Policy and Access Services (NPS) role
  • Azure Active Directory synched with on-premises Active Directory
  • Azure Active Directory GUID ID

Network requirements

The following table shows the required ports between RD Gateway, NPS Server, Internal network and WAN, and these ports must be opened for outbound and inbound

Source Destination Protocol/Port
Internet Gateway WAN NIC TCP: 443, 80 UDP: 3391 (You have to enable UDP on the RD Gateway)
Gateway LAN NIC Internal network TCP / UDP: 3389 TCP: 5504 TCP: 5985
Gateway LAN NIC Domain Controllers TCP / UDP: 88 TCP: 135 UDP: 123 UDP 137 TCP: 139 TCP / UDP: 389 TCP: 3268 TCP / UDP: 53 TCP / UDP: 445 TCP: 5985 TCP Dynamic Ports (NTDS RPC service)
RD Gateway NPS Server UDP: 1812 UDP: 1813
RD Gateway Perimeter network, should be opened for allowing HTTPS traffic from the client sitting on the Internet to the RD Gateway server in the perimeter network. TCP/ 443, 80

 

Certificate requirements

Public Certificate will be required that should contain the following SAN Names.

Item

SAN Names

Domain Certificate

RDS.3TALLAH.COM

System requirements

The following table shows the required subscription and license that should be provided by the time of the deployment:

Product Name

QTY

Microsoft 365 subscription (E3 plan) or equivalent (MFA License)

All users

Microsoft Windows Server 2016 Standard Edition

3

The following table summarizes Microsoft products that will be deployed

Product Name

QTY

Microsoft Windows Server 2016 Standard Edition

3

Network Policy and Access Services (NPS) role

2

Remote Desktop Gateway (RD Gateway) infrastructure

2

Authentication Flow

  1. F5 or any load balancer receives an Access request from a remote desktop user.
  2. F5 or any load balancer route the request to one of the RD Gateway serves.
  3. The Remote Desktop Gateway server receives an authentication request to connect to a resource, such as a Remote Desktop session. Acting as a RADIUS client, the Remote Desktop Gateway server converts the request to a RADIUS Access-Request message and sends the message to the RADIUS (NPS) server where the NPS extension is installed.
  4. The username and password combination are verified in Active Directory and the user is authenticated.
  5. If all the conditions as specified in the NPS Connection Request and the Network Policies are met (for example, time of day or group membership restrictions), the NPS extension triggers a request for secondary authentication with Azure MFA.
    1. Azure MFA communicates with Azure AD, retrieves the user’s details, and performs the secondary authentication using supported methods.
    2. Upon success of the MFA challenge, Azure MFA communicates the result to the NPS extension.
    3. The NPS server, where the extension is installed, sends a RADIUS Access-Accept message for the RD CAP policy to the Remote Desktop Gateway server.
  6. The user is granted access to the requested network resource through the RD Gateway.

Deploy High-Available RD Gateway Server Farm

Remote Desktop Gateway Server enables users to connect to remote computers on a corporate network from any external computer. The RD Gateway uses the Remote Desktop Protocol & the HTTPS Protocol to create a secure encrypted connection.

RD Gateway server uses port 443 (HTTPS), which provides a secure connection using a Secure Sockets Layer (SSL) tunnel.

Accounts

All the following accounts have been used.

Account or group name Source Description
Guest001 Local AD Account for RD Gateway Access
Office365 – EndUsers Local AD M365 Users License group
Guest001@3tallah.Com Local AD Account to connect with Azure AD

Environment

Server details.

Server Name IP Address Role
RDG01P 192.168.1.16 Remote Desktop Gateway server role

Network Policy Server (NPS) roleRDG02P192.168.1.17Remote Desktop Gateway server role

Network Policy Server (NPS) role

Install RD Gateway servers farm

Install RD Gateway server role on both RD Servers farm

Deploy NPS Role for NPS Extension server

The Network Policy Server (NPS) extension for Azure Multi-Factor-Authentication (Azure MFA) provides a simple way to add cloud-based MFA capabilities to your authentication infrastructure using your existing NPS servers. With the NPS extension, you’ll be able to add phone call, SMS, or phone app MFA to your existing authentication flow without having to significantly increase your existing authentication infrastructure.

Accounts

All the following accounts have been used.

Account or group name Source Description
Guest001 Local AD Account for RD Gateway Access
Office365 – EndUsers Local AD M365 Users License group
Guest001@3tallah.Com Local AD Account to connect with Azure AD

Environment

Server details.

Server Name IP Address Role
NPSEx01 192.168.1.18 Network Policy Server (NPS) role

NPS Extension for Azure MFA

The next steps will install the NPS role in your new server:

NPS Extension for Azure installation

As a part of the configuration of the NPS extension, you need to supply admin credentials and the Azure AD ID for your Azure AD tenant. The following steps show you how to get the tenant ID:

Get Azure AD ID

Install the NPS extension

  1. Copy the setup executable file to the NPS server.
  2. On the NPS server, double-click the executable. If prompted, click Run.
  3. In the NPS Extension for Azure MFA dialog box, review the software license terms, check I agree to the license terms and conditions, and click Install.
  4. On the NPS Extension for Azure MFA dialog box, click Close.

Configure certificates for use with the NPS extension

In this step, you need to configure certificates for the NPS extension to ensure secure communications. The NPS components include a Windows PowerShell script that configures a self-signed certificate for use with NPS.

This script performs the following actions:

  • Creates a self-signed certificate
  • Associates public key of certificate to service principal on Azure AD
  • Stores the cert in the local machine store
  • Grants access to the certificate’s private key to the network user
  • Restarts Network Policy Server service

To use the script, provide the extension with your Azure AD Admin credentials and the Azure AD tenant ID that you copied earlier. Run the script on each NPS server where you installed the NPS extension. Then do the following:

 

Configure NPS components on RD Gateway server

Once you have an NPS server running on your RDS environment, you need to configure the RD Gateway connection authorization policies to work with the NPS server. The authentication flow requires that RADIUS messages be exchanged between the RD Gateway and the NPS server.  This means that RADIUS client settings must be configured on both RD Gateway and NPS server.

Configure RD Gateway connection authorization policies to use a central store

Remote Desktop connection authorization policies (RD CAPs) specify the requirements for connecting to a RD Gateway server. By default, RD CAPs are stored locally, and MFA requires that they be stored in a central RD CAP store that is running NPS. Follow the steps below to configure the use of a central store.

On the RD Gateway server, open Server Manager.

Configure RADIUS client on RD Gateway NPS

NPS service

The NPS server with the NPS extension for Azure needs to be able to exchange messages with the RD Gateway. To enable this message exchange, you need to configure the NPS components on the NPS server.

Hence you must define an NPS client on the RD Gateway server to allow it to communicate to the NPS server with the NPS extension.

Configure RADIUS timeout value on RD Gateway NPS

To ensure there is time to validate users’ credentials, perform two-step verification, receive responses, respond to RADIUS messages, and if necessary, adjust the RADIUS timeout value.

  1. In the NPS (Local) console, expand RADIUS Clients and Servers, and select Remote RADIUS Server Groups. In the details page, double-click TS GATEWAY SERVER GROUP.

 

 

Click OK two times to close the dialog boxes.

Configure connection request policies on RD Gateway 1

By default, when you configure the RD Gateway to use a central policy store for connection authorization policies, the RD Gateway is configured to forward CAP requests to the NPS server. The NPS server, along with the Azure MFA extension, processes the RADIUS access request. You need to perform the following tasks:

  • Create from MFA policy to determine what happens when you receive a request from the NPS server.
  • Create to MFA policy to determine when to forward a request to the NPS server
  • Disable the default connection request policy.
  • Verify policies’ status and processing order.

Create “From MFA” connection request policy

Create “To MFA” connection request policy

Disable default connection request policy

Verify connection request policies list

Once you have added the two new policies and disabled the default one, you need to ensure that the policies’ status and processing order are correct. Your policy list should look like the picture below:

 

Configure Connection and Resource Authorization policies on RD Gateway 2

Register server in Active Directory

For the NPS server to function properly in this scenario, it needs to be registered in Active Directory.

Create RADIUS client

The RD Gateway needs to be configured as a RADIUS client to the NPS server.

 

Create RADIUS server group

You need a RADIUS server group to establish communication with the RD Gateway server.

 

Create connection request policies

Just like with the RD Gateway server, you must define policies to handle messaging exchange to/from the RD Gateway server.

Create “From RD Gateway” connection request policy

Create “To RD Gateway” connection request policy

 

Verify connection request policies list

Once you have added the two new policies, you need to ensure that the policies’ status and processing order are correct. Your policy list should look like the picture below:

Configure Network Policy

Because the NPS server with the MFA extension was designated as the central policy store for RD CAPs, you need to implement a new policy on the NPS server to authorize valid connections requests.

 

Verify configuration

To verify the configuration, you need to connect to your RD deployment through the RD Gateway server. Be sure to use an account that is allowed by your RD CAP.

 

Open any of the available resources It may ask you to enter your credentials.

 

 

 

References

The following articles are references used in this design document:

Title

Reference

Azure Active Directory

https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-whatis

Custom Domain Name

https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/add-custom-domain

Integrate your Remote Desktop Gateway infrastructure using the Network Policy Server (NPS) extension and Azure AD

https://docs.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-nps-extension-rdg

Remote Desktop Services – Multi-Factor Authentication

https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-plan-mfa

Add high availability to the RD Web and Gateway web front

https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-rdweb-gateway-ha

Remote Desktop Services – High availability

https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-plan-high-availability

Integrate your existing NPS infrastructure with Azure Multi-Factor Authentication

https://docs.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-nps-extension

END OF DOCUMENT

Mahmoud A. ATALLAH

Microsoft MVP | Speaker | Azure Service Delivery Lead at Bespin Global MEA, helping customers build successful Azure practices. Talks about #AzureCloud and #AI

Recent Posts

Gitex – Ensuring a Secure & Scalable AI-powered Solution with Azure

In this session, we will explore the architecture and best practices for building secure and…

1 month ago

Part 4: Data Exfiltration Playbook – Azure WAF Security Lab

Introduction Welcome to our comprehensive series on Azure Web Application Firewall (WAF) security! In this…

3 months ago

Part 3: Vulnerability Exploitation Playbook – Azure WAF vs XSS

Introduction Welcome to the third installment of our Azure Web Application Firewall (WAF) Security Lab…

3 months ago

Part 2: Reconnaissance Playbook – Testing Azure WAF Protection

Introduction Welcome to the second installment of our Azure Web Application Firewall (WAF) Security Lab…

4 months ago

Part 1: Lab Setup – Building Your Azure WAF Testing Environment

Introduction Welcome to the first installment of our four-part Azure Web Application Firewall (WAF) Security…

4 months ago

Azure Web Application Firewall: A Hands-on Security Lab Series

Introduction In today's digital landscape, protecting web applications from sophisticated attacks is crucial. Azure Web…

4 months ago