Skip to content

Deyda.net

Deyda Consulting Blog

  • Start Page
  • Consulting
  • About me
    • Privacy Policy
    • Imprint
    • Contact me
    • GitHub
  • NeverRed – Update your Software, the lazy way
    • NeverRed – Changelog
  • LinkedIn
  • Xing
  • Instagram
  • Twitter
  • E-Mail
Deyda.net

Citrix ADC as AD FS Proxy

Citrix ADC Version 12 als AD FS Proxy

Table of Contents

  • What is AD FS ?
  • Request to a 3rd Party AD FS Proxy
  • Sequence of an AD FS authentication
  • Setup AD FS Proxy
    • Requirements
    • Load Balancing
    • Content Switching
    • Rewrite
  • Test of the AD FS Proxy
  • Troubleshooting

This article is about creating an AD FS Proxy from Citrix ADC (version 12). The AD FS Proxy is used to authenticate e.g. external SaaS applications or websites via AD FS. The following should be achieved by the AD FS Proxy:

  • URL / DoS Protection
  • Suitable external authentication (MFA, Forms instead of Kerberos)
  • Account Lockout Protection
  • Availability (Load Balancing)

What is AD FS ?

Active Directory Federation Services (AD FS) is a feature in the Windows Server operating system that allows identity information to be shared outside of the corporate network. Users can access applications (e.g. Office365, Salesforce.com, etc.) without being prompted to provide credentials again. These applications can be hosted locally, in the cloud, or even by other companies. The user accounts can be managed by the administrator in a single location, the Active Directory.

A normal deployment of AD FS for external clients consists of AD FS Proxy and AD FS Server. The AD FS Server is a member of the domain and perform the authentication. The AD FS Proxy is usually located in a separate network zone (DMZ) so that it can be reached externally and forward the requests inwards.

Request to a 3rd Party AD FS Proxy

Microsoft describes the requirements for a 3rd party AD FS proxy as follows:

  • Body
    May not change the Body
  • Request Header
    All headers must be given 1:1 to the backend. Own headers may be added
  • No 302 Redirect
  • URL /adfs/services/trust
    All responses to this URL must be returned 1:1
  • URL /adfs/services/trust/mex
    Requests to this URL must be forwarded to the URL /adfs/services/trust/proxymex in the backend
  • NTLM
    If the NTLM login is also to be used via the proxy, an affinity must be maintained, so that the following requests go to the same backend server
  • HTTP Header (“X-MS-Proxy”) 
    For each request, this header must be added, so that the backend can see that the request came through a proxy and that the extranet configuration has to be used. This is required for the use of Account Lockout Protection.

Sequence of an AD FS authentication

To understand how AD FS works, let’s look at what happens when a federated user tries to log in to Office365:

  1. A user tries to log in to Office365 with his User Principal Name (UPN)
  2. The authentication platform checks the UPN and determines that the user is a federation identity. The authentication request is redirected to the user’s AD FS server. The platform knows the URL because a trust was previously set up between the AD FS Infrastructure and Office365 (Federation Trust).
  3. The client connects to the AD FS Proxy and provides credentials.
  4. The AD FS Proxy forwards the authentication request to the AD FS server.
  5. The AD FS server verifies the credentials through the local Active Directory.
  6. When the credentials have been verified, a domain controller returns a Kerberos token to the AD FS server.
  7. The AD FS server ignores the Kerberos token and creates a new AD FS token, which it forwards to the AD FS Proxy.
  8. The AD FS Proxy forwards the AD FS token to the client.
  9. The client passes the AD FS token to Office365 and is authenticated.
ADFS Proxy Auth

Setup AD FS Proxy

In my guide, I configure a Citrix ADC (version 12) as an AD FS Proxy for external authentication.

Requirements

I assume the following things and do not go into detail about them:

  • Citrix ADC with successful base configuration
  • Internal and external DNS records for AD FS
  • Certificates for DNS entries (wildcard certificates are the easiest)
  • Configured AD FS infrastructure

Load Balancing

First, create a service group for your existing AD FS servers.

Citrix ADC Service Group Add
  • In the Citrix ADC Navigation Panel, click Traffic Management> Load Balancing> Service Groups
  • Click Add to create a new service group
  • Give the service group a name (e.g. ADFS_SvcGroup) and select SSL for Protocol.
  • Confirm the entry with OK
Load Balancing Service Group
  • In the following window, click on No Service Group Member and add the ADFS servers via Select (With IP or FQDN)
Service Group Add Server
  • In the Load Balancing Service Group window, click on the pencil icon in Settings and configure the following
    • Surge Protection (Selected)
    • Use Proxy Port (Selected)
    • Down State Flush (Selected)
    • HTTP Compression (Selected)
    • Client IP (Selected)
    • Header (X-MS-Forwarded-Client-IP)
Service Group Settings

Now a load balancing vServer is created for the AD FS Proxy.

  • To do this, navigate to Traffic Management> Load Balancing> Virtual Servers
  • Via Add, you add a new virtual server and configure the Basic Settings in the following window
    • Name (e.g. ADFS_LB_Server)
    • Protocol (SSL)
    • IP Address Type (Non Addressable)
Load Balancing Virtual Server Basic Settings
  • Select No Load Balancing Virtual Server Service Binding and connect the previously generated Service Group (ADFS_SvcGroup)
  • Via No Server Certificate you connect your certificate for the AD FS Proxy (the simplest is a wildcard certificate)
Load Balancing Virtual Server Service Group Binding

Content Switching

Next, you will create the appropriate content switching components. First, the content switching policies. Please note that the given address (adfs.deyda.net) corresponds to the external DNS entry.

Content Switching Policies
  • In the Citrix ADC Navigation Panel, click Traffic Management> Content Switching> Policies
  • Click Add to create a new content switching policy
    • Name (e.g. ADFS_CS_Policy_ADFS)
    • Expression (HTTP.REQ.HOSTNAME.SET_TEXT_MODE(IGNORECASE).EQ(“adfs.deyda.net”)&&HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).CONTAINS(“/adfs”))
    • With Create you confirm the inputs
Create Content Switching Policy
  • Click Add again to create another content switching policy
    • Name (e.g. ADFS_CS_Policy_Metadata)
    • Expression (HTTP.REQ.HOSTNAME.SET_TEXT_MODE(IGNORECASE).EQ(“adfs.deyda.net”)&&HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).CONTAINS(“/FederationMetadata”))
    • Confirm the entry with Create
Create Content Switching Policy

Now the Content Switching vServer is created, to which the IP address, that is entered in the external DNS entry (e.g adfs.deyda.net), is bound.

  • In the Citrix ADC Navigation Panel, click Traffic Management> Content Switching> Virtual Servers
  • Click Add to create a new content switching virtual server
    • Name (e.g. ADFS_CS_Server)
    • Protocol (SSL)
    • Target Type (NONE)
    • IP Address Type (IP Address)
    • IP Address (external IP address for the DNS entry)
    • Port (443)
  • With OK you confirm the input
Content Switching Virtual Server

Now, the previously created Content Switching Policies (ADFS_CS_Policy_ADFS / ADFS_CS_Policy_Metadata) will be bound to the currently created Virtual Server (ADFS_CS_Server).

Content Switching Policy Binding
  • In the opened Content Switching Virtual Server, click No Content Switching Policy Bound
  • In the Policy Binding window, click Add Binding
    • Select Policy (ADFS_CS_Policy_ADFS)
    • Priority (100)
    • Goto Expression (END)
    • Invoke LabelType (None)
    • Target Load Balancing Virtual Server (ADFS_LB_Server)
  • Click on Bind to confirm
Policy Binding
  • In the Policy Binding window, click Add Binding again
    • Select Policy (ADFS_CS_Policy_Metadata)
    • Priority (110)
    • Goto Expression (END)
    • Invoke LabelType (None)
    • Target Load Balancing Virtual Server (ADFS_LB_Server)
  • Click on Bind to confirm
Policy Binding

Rewrite

Now you have to create Rewrite Policies and Actions that need to be connected to the Load Balancer Virtual Server later.

Rewrite Actions
  • In the Citrix ADC Navigation Panel, click on App Expert> Rewrite> Actions
  • Click Add to create a new Rewrite Action
    • Name (e.g. ADFS_Rewrite_ProxyHeader)
    • Type (INSERT_HTTP_HEADER)
    • Header Name (X-MS-Proxy)
    • Expression (“NETSCALER”)
  • With Create you confirm the input
Rewrite Action Proxy Header
  • Click Add again to create another new Rewrite Action
    • Name (e.g. ADFS_Rewrite_Mex)
    • Type (REPLACE)
    • Expression to choose target location (HTTP.REQ.URL.PATH_AND_QUERY)
    • Expression (“/adfs/services/trust/proxymex” + HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).PATH_AND_QUERY.STRIP_START_CHARS(“/adfs/services/trust/mex”).HTTP_URL_SAFE)
  • With Create you confirm the input
Rewrite Action Mex
  • In the Citrix ADC Navigation Panel, click on App Expert> Rewrite> Policies
  • Click Add to create a new Rewrite Policy
    • Name (e.g. ADFS_Rewrite_Policy_ProxyHeader)
    • Action (ADFS_Rewrite_ProxyHeader)
    • Expression (HTTP.REQ.URL.TO_LOWER.STARTSWITH(“/adfs”)
  • With Create you confirm the input
Create Rewrite Policy
  • Click Add again to create another Rewrite Policy
    • Name (e.g. ADFS_Rewrite_Policy_Mex)
    • Action (ADFS_Rewrite_Mex)
    • Expression (HTTP.REQ.URL.TO_LOWER.STARTSWITH(“/adfs/services/trust/mex”)
  • With Create you confirm the input
Create Rewrite Policy Mex

To bind the Rewrite Policies to the Load Balancer, open the created Load Balancer (ADFS_LB_Server) and click on Policies on the right side.

Load Balancer Virtual Server Policies

In the new tab Policies click on the + icon.

Load Balancer Policies

Then you configure the Policy Type.

  • Choose Policy (Rewrite)
  • Choose Type (Request)
  • Confirm with Continue
Policies Choose Type
  • Select Policy (ADFS_Rewrite_Policy_ProxyHeader)
  • Priority (100)
  • Goto Expression (NEXT)
  • Invoke LabelType (None)
  • Continue with Bind
Policy Binding
  • Select Policy (ADFS_Rewrite_Policy_Mex)
  • Priority (110)
  • Goto Expression (END)
  • Invoke LabelType (None)
  • Continue with Bind
Rewrite Policy Binding

Test of the AD FS Proxy

You can use the following addresses to test the AD FS Proxy.

https://adfs.deyda.net/adfs/ls/idpinitiatedsignon.htm

adfs/ls/idpinitiatedsignon.htm

https://adfs.deyda.net/FederationMetadata/2007-06/FederationMetadata.xml

FederationMetadata/2007-06/FederationMetadata.xml

Troubleshooting

If the pages can not be opened from the outside, in my experience, the most common mistake is the binding of the certificates.

To fix this, open a PowerShell window as an administrator on an ADFS machine and enter the following command:

PowerShell
1
netsh http show sslcert

From the display of the SSL Certificate bindings you copied out the following lines:

  • Certificate Hash
  • Application ID
  • Certificate Store Name

Then you enter the following command to bind the existing certificate to all addresses of the server (the brackets are replaced completely with the respective value):

PowerShell
1
netsh http add sslcert ipport=0.0.0.0:443 certhash=[Certificate Hash] appid=[Application ID] certstorename=[Certificate Store Name]

Example:

PowerShell
1
netsh http add sslcert ipport=0.0.0.0:443 certhash=a54564146545e454f484f48eb4 appid='(58784354-beb4-8795-4548a6e4a)' certstorename=MY

This command must then be executed on all ADFS machines.

Teilen mit:

  • Click to share on X (Opens in new window) X
  • Click to share on X (Opens in new window) X
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print

Like this:

Like Loading...

Related posts:

  1. Citrix ADC as initial IdP for Office365
  2. SAML Authentication with Azure AD as IdP and Citrix as SP
  3. SAML Authentication between Citrix & Microsoft with Azure MFA
  4. Microsoft Azure MFA Server in Citrix ADC
Author Manuel WinkelPosted on February 26, 2019April 28, 2020Categories ADC, Azure, Citrix, Microsoft, Office365Tags AD FS, AD FS Proxy, Citrix, Citrix ADC, Citrix Gateway, Content Switching, Federated Domain, FederationMetadata.xml, IdPinitiatedSignOn.htm, Load Balancing, Microsoft, NetScaler, Office365, Principal, Rewrite, Single-Sign On

Post navigation

Previous Previous post: Citrix ADC as initial IdP for Office365
Next Next post: Microsoft Azure MFA Server in Citrix ADC

Sprachen

  • Deutsch
  • English

Manuel Winkel Follow

Citrix Technology Professional (CTP) - Presales Engineer at @ControlUp - Deyda Consulting - CCE-V - CCE-N - CCP-M - MCSA - MCSE - Father of 3

Deyda84
deyda84 Manuel Winkel @deyda84 ·
27 Jun

🚨 CVE-2025-6543 is actively exploited in the wild.
Found multiple vulnerable NetScaler instances exposed online.
Update your Citrix ADC now!🛡️



#Citrix #NetScaler #CVE2025 #CyberSecurity

Reply on Twitter 1938540485649309894 Retweet on Twitter 1938540485649309894 8 Like on Twitter 1938540485649309894 14 Twitter 1938540485649309894
deyda84 Manuel Winkel @deyda84 ·
26 Jun

CVE Alert
New Security Bulletin for NetScaler (CVE-2025-6543)

https://www.deyda.net/index.php/en/2025/06/17/checklist-for-netscaler-citrix-adc-cve-2025-5777

#Citrix #CitrixCTP #CVE #security #NetScaler

Reply on Twitter 1938128306764976360 Retweet on Twitter 1938128306764976360 1 Like on Twitter 1938128306764976360 3 Twitter 1938128306764976360
deyda84 Manuel Winkel @deyda84 ·
17 Jun

CVE Alert 🚨🚨🚨

New Security Bulletin for NetScaler ADC.

https://www.deyda.net/index.php/en/2025/06/17/checklist-for-netscaler-citrix-adc-cve-2025-5777/

#Citrix #CitrixCTP #CVE #security

Reply on Twitter 1935005756354388217 Retweet on Twitter 1935005756354388217 1 Like on Twitter 1935005756354388217 4 Twitter 1935005756354388217
Load More...

Categories

  • Basic (1)
  • Citrix (43)
    • ADC (14)
    • StoreFront (3)
    • Virtual Apps and Desktops (20)
    • WEM (13)
  • Microsoft (20)
    • Azure (8)
    • Exchange (1)
    • FSLogix (4)
    • Office365 (11)
    • PowerShell (3)
    • SQL (2)
  • NVIDIA (1)

Tag Cloud

Virtual Apps SAML ADMX NetScaler Gateway Intelligent I/O Optimization Intelligent Memory Optimization NetScaler Virtual Desktop Applet Name Citrix Microsoft PowerShell Office UPM Unified Gateway Netscaler IP SQL Server Upgrade Active Directory SQL Express AppLocker Citrix ADC Intelligent CPU Optimization XenApp StoreFront Azure AD UEM Remote Desktop Windows Server Citrix Gateway Teams Universal Profile Management User Environment Management FSLogix Configuration Set Administration Console NetScaler LoadBalancer XenDesktop Single-Sign On Folder Redirection Performance Management Workspace Environment Management Office365 Norskale Broker Service WEM

Recent Posts

  • Checklist for NetScaler (Citrix ADC) CVE-2025-5777 & CVE-2025-6543 June 26, 2025
  • Install new Microsoft Teams (version 2) in Citrix May 17, 2024
  • Checklist for NetScaler (Citrix ADC) CVE-2023-4966 December 12, 2023
  • SAML Authentication between Citrix & Microsoft with Azure MFA September 8, 2023
  • Checklist for NetScaler (Citrix ADC) CVE-2023-3519 July 19, 2023

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Start Page
  • Consulting
  • About me
    • Privacy Policy
    • Imprint
    • Contact me
    • GitHub
  • NeverRed – Update your Software, the lazy way
    • NeverRed – Changelog
  • LinkedIn
  • Xing
  • Instagram
  • Twitter
  • E-Mail
Deyda.net Privacy Policy Proudly powered by WordPress
%d