Skip to content

Configure Mideye MFA for Remote Desktop Services with ADFS

  • Mideye Server 5
  • Functional Microsoft RDS-environment installed with a Remote Desktop Gateway.
  • Functional Microsoft ADFS with WAP.
  • WAP must be a member of the domain.
  • Windows 10 client with Internet Explorer (or Edge in IE mode — other browsers are not supported)

Open ADFS management console Relying Party TrustsAdd Relying Party Trust.

Create a relying party that is configured manually (without any metadata), and without any enabled support for WS-federation Passive Protocol or SAML 2.0 WebSSO protocol. Only add a trust identifier that should be the public DNS of your RD-gateway (i.e https://remoteapps.mideye.dev)

You can either create a Relying Party in the Windows Gui or in powershell.

Configure ADFS relying party in Windows gui

Section titled “Configure ADFS relying party in Windows gui”

ADFS — select Claims aware trust type

ADFS — select Enter data about the relying party manually

ADFS — enter display name for the relying party

ADFS — configure certificate (skip)

ADFS — configure SSO URL (skip)

ADFS — add trust identifier with RD Gateway URL

ADFS — select Permit everyone and require MFA

ADFS — add relying party trust confirmation

ADFS — do not configure claim issuance policy

Configure ADFS relying party in Powershell

Section titled “Configure ADFS relying party in Powershell”
Terminal window
Add-AdfsRelyingPartyTrust -Name "RDS-2019" -Identifier "https://remoteapps.mideye.dev"
Set-AdfsRelyingPartyTrust -TargetName "RDS-2019" -AccessControlPolicyName "Permit everyone and require MFA"

2. Active Directory - Configure ServicePrincipal Name on WAP

Section titled “2. Active Directory - Configure ServicePrincipal Name on WAP”

Add A service principal name for the Web Application Proxy (WAP), This should be the same as the external DNS for end users, in this scenario HTTP/remoteapps.mideye.dev

Do this configuration either in powershell or Windows GUI

Enable Advanced features Active Directory Users and Computers — enable Advanced features

Select WAP computer properties Active Directory — WAP computer properties

Edit servicePrincipalName Active Directory — edit servicePrincipalName attribute

Add HTTP/remoteapps.mideye.dev (External RDGW URL) as SPN Active Directory — add HTTP SPN for external RD Gateway URL

Get all ServicePrincipalNames of WAP server and verify HTTP/remoteapps.mideye.dev does not exist there already.

Terminal window
Get-ADcomputer -Identity "rdslab-wap" -Properties ServicePrincipalNames |Select-Object -ExpandProperty ServicePrincipalNames
WSMAN/rdslab-wap
WSMAN/rdslab-wap.mideye.local
TERMSRV/rdslab-wap
TERMSRV/rdslab-wap.mideye.local
RestrictedKrbHost/rdslab-wap
HOST/rdslab-wap
RestrictedKrbHost/rdslab-wap.mideye.local
HOST/rdslab-wap.mideye.local

Add RDS gateway SPN to WAP server in a Active Directory Domain Controller.

Set-ADComputer -Identity "rdslab-wap" -Add @{"ServicePrincipalName"="HTTP/remoteapps.mideye.dev"}

3. Active Directory - Configure Delegation on WAP

Section titled “3. Active Directory - Configure Delegation on WAP”

Delegate HTTP/remoteapps.mideye.dev to WAP.

Do this configuration either in powershell or Windows GUI

Select WAP computer properties Active Directory — WAP computer properties

Set Trust this computer for delegation to specified services only and Use any authentication protocol and click Add… Active Directory — Delegation tab, trust for specified services

Click Users or Computers… to find a computer to delegate from. Active Directory — Add Services dialog

Type the name of the WAP. Click check-names and OK. Active Directory — check-names for WAP computer

Select Service Type: HTTP and User or Computer: remoteapps.mideye.dev Active Directory — select HTTP service for RD Gateway delegation

Now the http delegation should be added to the WAP server. Active Directory — delegation added to WAP server

```
Get-ADComputer -Identity "rdslab-wap" | Set-ADAccountControl -TrustedToAuthForDelegation $True
Set-ADComputer -Identity "rdslab-wap" -Add @{'msDS-AllowedToDelegateTo'=@('HTTP/remoteapps.mideye.dev')}
```

4. Web Application Proxy - Publish a web application

Section titled “4. Web Application Proxy - Publish a web application”

DNS RECORD

At this time remoteapps.mideye.dev DNS should externally point at the WAP. Internally remoteapps.mideye.dev needs to point at the Remote Desktop Services Web Access Gateway. If remoteapps.mideye.dev points at WAP internally also, then WAP remoteapps.mideye.dev needs to be in the hosts file.

Right-click Windows button and open Windows PowerShell (Admin)

Terminal window
notepad.exe $env:windir\System32\drivers\etc\hosts

Add a new entry that points to the internal ip of remoteapps.mideye.dev (Or Remote Desktop Services Web Access Gateway) 10.10.10.10 remoteapps.mideye.dev

Publish remoteapps in wap

Open the WAP-console and click “publish”. Select ADFS followed by Web and MSOFBA. Select the Relying party created on the ADFS-server and give the publish a friendly name followed by the external DNS and the internal DNS. This should be the same, and in this scenario https://rdweb.mideye.com. Select a valid certificate.

Do this configuration either in powershell or Windows GUI

  • Click Publish in Remote Access Management Console WAP — click Publish in Remote Access Management Console
  • Click Next in Welcome screen WAP — Publish New Application wizard welcome screen
  • Select Active Directory Federation Services (AD FS) WAP — select ADFS pre-authentication
  • Select Web and MSOFBA WAP — select Web and MSOFBA support
  • Add a name, external URL, certificate and backend URL for RDGateway WAP — publishing settings with name, URLs, and certificate
  • Validate configuration or copy powershell command for documentation. WAP — confirmation and PowerShell command
  • Continue when Application is published successfully. WAP — application published successfully
  • Verify that name and external URL is correct in published web applications. WAP — published web applications list
Remember to change BackendServerUrl, ExternalUrl, ADFSRelyingPartyName and Thumbprint accordingly.
```powershell
Add-WebApplicationProxyApplication -BackendServerUrl 'https://remoteapps.mideye.dev' -ExternalCertificateThumbprint '86BF27B9EA4AC0D9A0996BA8D94F31595276443B' -EnableHTTPRedirect:$true -ExternalUrl 'https://remoteapps.mideye.dev' -Name 'remoteapps - rds 2019' -ExternalPreAuthentication ADFS -ADFSRelyingPartyName 'RDS 2019'
```

Disable Cookie Protection

On the WAP server. Right-click Windows button and open Windows PowerShell (Admin)

-Name should be the same as in WebApplication Proxy Application created in previous step.

Terminal window
Get-WebApplicationProxyApplication -Name "remoteapps - rds 2019" | Set-WebApplicationProxyApplication -DisableHttpOnlyCookieProtection:$true

  • Enable Windows Auth

Enable windows authentication and disable forms.

  • Open IIS and navigate to the server and open “Authentication”

IIS — open Authentication settings

  • Set Windows authentication to “Enabled”
  • Set Forms Authentication to “Disabled”

IIS — enable Windows authentication and disable Forms


  • HTTP Redirect

Navigate to “Default Web Site” followed by “HTTP redirect”. Create a redirect to /RDweb and check the “Only redirect requests to content in this directory” box. Click apply.

  • Open IIS Management console

IIS — open IIS Management console

  • Navigate to Default Site and HTTP redirect

IIS — navigate to Default Site HTTP Redirect

  • Change Redirect url to /RDweb
  • Uncheck Redirect all requests to exact destination (instead of relative to destination)
  • Check the Only redirect requests to content in this directory (not subdirectories)

IIS — configure redirect to /RDweb for directory only


  • Modify web.config

Right-click Windows button and open Windows PowerShell (Admin)

Edit Webconfig

Terminal window
notepad.exe $env:windir\Web\RDWeb\Pages\Web.config
  • Enable Windows authentication (uncomment)
  • Disable Forms authentication (comment)

Enable Windows Authentication xml <authentication mode="Windows"> <!-- <authentication mode="Forms"> <forms loginUrl="default.aspx" name="TSWAAuthHttpOnlyCookie" protection="All" requireSSL="true" /> </authentication> -->

File before edit xml <!-- <authentication mode="Windows"/> --> <authentication mode="Forms"> <forms loginUrl="default.aspx" name="TSWAAuthHttpOnlyCookie" protection="All" requireSSL="true" /> </authentication>

  • Disable the forms authentication module

Disable Forms Module xml </handlers> <!-- <modules runAllManagedModulesForAllRequests="true"> <remove name="FormsAuthentication" /> <add name="RDWAFormsAuthenticationModule" type="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication.TSDomainFormsAuthentication" /> </modules> -->

File before Edit xml </handlers> <modules runAllManagedModulesForAllRequests="true"> <remove name="FormsAuthentication" /> <add name="RDWAFormsAuthenticationModule" type="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication.TSDomainFormsAuthentication" /> </modules>

  • Set windowsauthentication to true
  • Set anonymousAuthentication to false

Set authentication methods xml <security> <authentication> <windowsAuthentication enabled="true" /> <anonymousAuthentication enabled="false" /> </authentication> </security> File before edit xml <security> <authentication> <windowsAuthentication enabled="false" /> <anonymousAuthentication enabled="true" /> </authentication> </security>

Save and close Web.config file.

Modify default.aspx

Right-click Windows button and open Windows PowerShell (Admin)

Terminal window
notepad.exe $env:windir\Web\RDWeb\Pages\en-US\Default.aspx

Edit line 35 so it looks like following usually its just bPrivateMode = true that needs to be changed.

public bool bShowPublicCheckBox = false, bPrivateMode = true, bRTL = false;

Save and close.

Right-click Windows button and open Windows PowerShell (Admin)

Run iisreset

Terminal window
iisreset.exe

From the active connection broker, run the following command from an elevated powershell prompt. Change collection name and pre-authentication server.

Right-click Windows button and open Windows PowerShell (Admin)

Terminal window
Import-Module RemoteDesktop
Set-RDSessionCollectionConfiguration -CollectionName RemoteApps -CustomRdpProperty "pre-authentication server address:s:https://remoteapps.mideye.dev`nrequire pre-authentication:i:1"

Verify configuration

Terminal window
(Get-RDSessionCollectionConfiguration -CollectionName RemoteApps).CustomRdpProperty
pre-authentication server address:s:https://remoteapps.mideye.dev
require pre-authentication:i:1
use redirection server name:i:1

7. Configure Users Client Internet Explorer ONLY!

Section titled “7. Configure Users Client Internet Explorer ONLY!”
  • Open Internet Explorer and go to Internet Options. Select Security and add the URL to trusted sites (https://remoteapps.mideye.dev which should point at WAP)

  • Click Close and select Custom Level

  • At the bottom of the list, select automatic logon with current username and password.

Description: Error message with Your computer can’t connect to the remote computer because authentication to the firewall failed due to missing firewall credentials…

RDP error — authentication to the firewall failed due to missing credentials

This happens when opening the RDP file/link from something else than Internet Explorer to connect to RDWeb.