Federation with AD FS

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 12 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Lesson: Federation with Active Directory Federation Services (AD FS)

Introduction: The Necessity of Hybrid Identity

In the modern enterprise landscape, the perimeter of the network has effectively dissolved. Organizations no longer operate entirely within the confines of a single data center; instead, they rely on a mix of on-premises infrastructure and cloud-based Software as a Service (SaaS) applications. This transition creates a significant challenge: how do you ensure that users can access resources across these disparate environments without maintaining multiple, fragmented identity stores? This is where Hybrid Identity comes into play, and specifically, the role of federation.

Federation is a method of linking a user’s identity across multiple, separate security domains. Instead of forcing a user to create a new username and password for every application they use, federation allows the user to authenticate against a central, trusted identity provider. The application then trusts the assertions provided by this identity provider to grant access. Active Directory Federation Services (AD FS) is Microsoft’s standard implementation of this concept for Windows-based environments.

Understanding AD FS is critical for any identity engineer because it provides a mechanism for Single Sign-On (SSO) that works across organizational boundaries. Whether you are connecting your internal Active Directory (AD) to Microsoft 365, or providing access to third-party applications like Salesforce or ServiceNow, AD FS acts as the bridge. By mastering this technology, you ensure that your organization maintains centralized control over authentication policies, security posture, and access logs, even when the data being accessed resides in the cloud.


Not read yet

Understanding the Core Architecture of AD FS

At its heart, AD FS is a standards-based identity service. It relies on protocols such as Security Assertion Markup Language (SAML), WS-Federation, and OpenID Connect (OIDC) to facilitate the exchange of identity information. When a user attempts to access a federated application, they are redirected to the AD FS server. The AD FS server validates the user's credentials against the on-premises Active Directory and issues a security token. The application receives this token, verifies its signature, and grants the user access based on the claims contained within that token.

Key Architectural Components

To implement AD FS effectively, you must understand the roles played by the different components in the architecture:

  • AD FS Federation Server: This is the primary server that handles authentication requests and issues security tokens. It is usually deployed in the internal network and integrated with your Active Directory Domain Services (AD DS).
  • Web Application Proxy (WAP): This component acts as a reverse proxy for the AD FS server. It is typically placed in a DMZ (demilitarized zone) and handles requests coming from the internet, relaying them to the internal AD FS server. This ensures that your internal identity servers are never directly exposed to the public internet.
  • Claims Provider: The entity that authenticates the user. In our scenario, this is your internal Active Directory domain.
  • Relying Party: The application or service that trusts the AD FS server to provide identity information. This could be an Office 365 tenant, a SaaS application, or another organization's federation service.
  • Claim Rules: The logic engine within AD FS that determines what information (claims) is sent to the relying party. For example, you might send an email address as a "NameID" claim to a specific application.

Callout: Federation vs. Synchronization It is common to confuse federation with directory synchronization (like Azure AD Connect). Synchronization copies user objects from your on-premises AD to a cloud directory. Federation, however, does not move user objects; it keeps the authentication process on-premises. With federation, the cloud application asks your AD FS server, "Is this user who they say they are?" every time they log in.


Not read yet

Preparing Your Environment for AD FS Deployment

Before you begin the installation process, you must ensure that your infrastructure is prepared. AD FS is not a "set it and forget it" service; it is a mission-critical component. If your AD FS server goes down, your users lose access to every single application that relies on it for authentication.

Prerequisites Checklist

  • Active Directory Domain Services: You must have a functional Windows Server Active Directory environment. Ensure that your domain functional level is compatible with the version of Windows Server you intend to run AD FS on.
  • Certificate Services: AD FS requires SSL/TLS certificates to secure communication. You will need a certificate for the AD FS service communication (e.g., sts.yourdomain.com). It is highly recommended to use a publicly trusted certificate authority (CA) rather than an internal one, especially if your users are accessing resources from outside the corporate network.
  • Network Infrastructure: Ensure that the necessary ports are open. AD FS typically uses TCP port 443 (HTTPS) for incoming authentication traffic. If you are using a WAP, it must be able to communicate with the internal AD FS server over port 443.
  • Service Accounts: You should create a Managed Service Account (MSA) or a Group Managed Service Account (gMSA) to run the AD FS service. This is a security best practice because it removes the need to manually manage the password of the service account.

Tip: Use gMSAs for AD FS Using a Group Managed Service Account (gMSA) is significantly more secure than using a standard user account. The Windows operating system handles the password rotation automatically, reducing the risk of a compromised password or service outage due to account lockout policies.


Not read yet

Step-by-Step: Installing and Configuring AD FS

The installation process is performed through the Server Manager console on a Windows Server instance. Once the binaries are installed, you must run the configuration wizard to define the farm settings.

1. Install the AD FS Role

  1. Open Server Manager and select Add Roles and Features.
  2. Navigate to the Server Roles tab and check the box for Active Directory Federation Services.
  3. Proceed through the wizard, accepting the defaults, and click Install.

2. Configure the AD FS Farm

Once the role is installed, you will see a notification in Server Manager to "Configure the federation service on this server."

  1. Click the notification to launch the AD FS Configuration Wizard.
  2. Select Create the first federation server in a federation server farm.
  3. Choose your AD Domain Service account or gMSA.
  4. Specify the SSL certificate you prepared earlier.
  5. Provide a Federation Service Name (e.g., sts.contoso.com). This name must match the subject alternative name (SAN) on your SSL certificate.
  6. Select the database for the configuration data. For small-to-medium deployments, the Windows Internal Database (WID) is sufficient. For high-availability, enterprise-scale deployments, use a Microsoft SQL Server instance.

3. Deploy the Web Application Proxy (WAP)

The WAP should be installed on a separate, dedicated server, usually in the DMZ. The installation process is similar to the AD FS server, but the configuration role is "Web Application Proxy." Once installed, you will need to establish a trust relationship between the WAP and the internal AD FS server using a set of administrative credentials.


Not read yet

Managing Claims and Relying Party Trusts

Once your infrastructure is up, the real work begins: connecting applications. This is handled via Relying Party Trusts. A Relying Party Trust is essentially a configuration object that tells AD FS which application is requesting identity information and what rules should be applied to the authentication response.

Adding a Relying Party Trust

  1. Open the AD FS Management Console.
  2. Right-click on Relying Party Trusts and select Add Relying Party Trust.
  3. If the application provides a metadata URL (common for SaaS apps), you can import the configuration automatically. Otherwise, you will need to manually enter the identifier and the SAML endpoint URL provided by the application vendor.
  4. Define the Claim Issuance Policy. This is where you map AD attributes to the claims the application expects.

Understanding Claim Rules

Claim rules are the "logic" of your federation. A typical rule might look like this:

  • Rule: Send LDAP Attributes as Claims.
  • LDAP Attribute: E-Mail-Addresses
  • Outgoing Claim Type: Email Address

This rule tells AD FS to look up the user's email address in Active Directory and send it to the application in the SAML token with the label "Email Address." If the application expects a different attribute name, such as "UserPrincipalName," you simply create a rule to map that attribute instead.

Example: Custom Claim Transformation

Sometimes, you need to transform data before sending it. For example, if your AD stores user roles as a comma-separated string, but your application expects individual roles as separate claims, you can use a custom rule:

c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]
=> issue(store = "Active Directory", types = ("http://schemas.microsoft.com/ws/2008/06/identity/claims/role"), query = "{0}", param = c.Value);

Note: This is a simplified example. Complex transformations often require writing custom rules using the AD FS claim rule language, which is a powerful, albeit complex, syntax.


Not read yet

Security Best Practices for AD FS

Because AD FS is the "front door" to your applications, it is a high-value target for attackers. Securing your AD FS environment is not just about keeping the lights on; it is about protecting your entire identity perimeter.

1. Extranet Lockout

Attackers often use "password spraying" attacks against AD FS to guess passwords. Enabling Extranet Lockout allows AD FS to track failed login attempts from the internet and block the account after a certain number of failures, preventing the lockout from propagating to the internal Active Directory.

2. Multi-Factor Authentication (MFA)

Never rely on single-factor authentication for federated applications. AD FS supports integrating with MFA providers. You should configure authentication policies that require MFA for any access coming from outside the corporate network (the extranet).

3. Monitoring and Auditing

You must enable auditing for AD FS events. These logs are stored in the Windows Event Logs and provide critical information about who is authenticating, which applications they are accessing, and whether any authentication failures occurred. Consider using a Security Information and Event Management (SIEM) system to aggregate these logs and alert on suspicious activity.

4. Minimize Exposure

Never expose your internal AD FS Federation Server directly to the internet. Always use a Web Application Proxy or a dedicated load balancer that supports pre-authentication. Ensure that your servers are patched regularly, as vulnerabilities in the underlying Windows Server OS can compromise the AD FS service.


Not read yet

Comparison: AD FS vs. Modern Identity Solutions

It is helpful to compare AD FS with modern, cloud-native identity solutions like Microsoft Entra ID (formerly Azure AD).

Feature AD FS Microsoft Entra ID
Hosting On-premises (Self-managed) Cloud (SaaS)
Scalability Manual (Requires hardware/VMs) Automatic (Global scale)
Complexity High (Requires infrastructure) Low (Config-based)
Maintenance High (Patching, backups) Minimal (Managed by vendor)
Primary Use Legacy apps / Strict compliance Modern SaaS / Hybrid apps

Warning: The "Hidden" Costs of AD FS While AD FS is a powerful tool, it comes with significant operational overhead. You are responsible for the availability, security, and performance of the servers. Many organizations find that migrating to a cloud-native identity provider reduces their total cost of ownership (TCO) and provides better security features out of the box.


Common Pitfalls and Troubleshooting

Even with careful planning, issues will arise. Here are the most common problems identity engineers face when managing AD FS.

1. Certificate Mismatch

This is the number one cause of AD FS outages. If the SSL certificate used by AD FS expires, or if the subject name does not match the Federation Service Name, the trust relationship will break immediately.

  • Fix: Use a monitoring tool to track certificate expiration dates. Ensure that you have a clear process for renewing and updating certificates on both the internal AD FS servers and the WAP servers.

2. Time Synchronization Issues

Kerberos, which AD FS uses to authenticate against Active Directory, is extremely sensitive to time differences. If your AD FS server clock drifts by more than five minutes from the Domain Controller clock, authentication will fail.

  • Fix: Ensure all your servers are configured to synchronize time against a reliable NTP source, such as your primary domain controller or an external time server.

3. Misconfigured Relying Party Identifiers

When setting up a new application, the "Relying Party Identifier" must match exactly what the application sends in its authentication request. A trailing slash or a missing "s" in "https" is often enough to cause a failure.

  • Fix: Always copy-paste the identifier directly from the application's metadata or configuration guide. If you see an error in the Event Viewer stating "The identifier is not valid," double-check this field.

4. WAP Trust Issues

If the WAP loses its trust relationship with the internal AD FS server, it will no longer be able to relay requests. This can happen if the computer account password of the WAP server in AD is reset or if the trust token expires.

  • Fix: You may need to re-run the Install-WebApplicationProxy cmdlet to re-establish the trust.

Not read yet

Advanced Scenarios: Claims Providers and Trust Relationships

While we have focused on AD as the Claims Provider, AD FS is flexible enough to support other providers. For example, you might want to federate with another organization (B2B federation). In this case, your AD FS server would treat the partner's federation service as a "Claims Provider Trust."

Configuring a Claims Provider Trust

  1. In the AD FS console, navigate to Claims Provider Trusts.
  2. Select Add Claims Provider Trust.
  3. Import the federation metadata from the partner organization.
  4. Configure the transformation rules to accept the incoming claims from the partner and translate them into claims that your internal applications understand.

This capability allows for seamless collaboration between organizations. Your users can log in using their own credentials, and your AD FS server will trust the authentication performed by the partner's identity provider.


Not read yet

Industry Best Practices for Lifecycle Management

Implementing AD FS is only the beginning. Maintaining the environment requires a disciplined approach to lifecycle management.

  • Documentation: Maintain an up-to-date document of all Relying Party Trusts, including the contact person for each application, the renewal dates for certificates, and the specific claim rules used.
  • Testing: Before applying any changes, such as modifying a claim rule or updating a certificate, test the change in a staging environment. AD FS is a single point of failure; you cannot afford to "fix it in production."
  • Regular Audits: Conduct quarterly reviews of your Relying Party Trusts. Remove any applications that are no longer in use. Stale trusts represent a security risk, as they provide an unnecessary surface for potential unauthorized access.
  • Disaster Recovery: Have a documented disaster recovery plan for your AD FS farm. If your primary site fails, how quickly can you restore the AD FS configuration? Keep backups of your configuration database (if using SQL) and your service certificates.

Not read yet

Practical Example: Automating AD FS Configuration with PowerShell

Managing AD FS via the graphical interface is fine for small environments, but automation is key for enterprise-scale management. PowerShell allows you to perform complex tasks with consistency.

Example: Adding a Relying Party Trust via PowerShell

# Define the parameters for the new Relying Party
$name = "FinanceApp"
$identifier = "https://finance.contoso.com"
$metadataUrl = "https://finance.contoso.com/FederationMetadata/2007-06/FederationMetadata.xml"

# Add the Relying Party Trust
Add-AdfsRelyingPartyTrust -Name $name `
                          -MetadataUrl $metadataUrl `
                          -IssuanceAuthorizationRules "=> issue(type = 'http://schemas.microsoft.com/authorization/claims/permit', value = 'true');"

# Verify the addition
Get-AdfsRelyingPartyTrust -Name $name

Explanation: This script automates the process of adding a new application to your AD FS environment. By using the Add-AdfsRelyingPartyTrust cmdlet, you ensure that the configuration is applied identically every time, reducing the chance of human error. The IssuanceAuthorizationRules parameter sets a default policy that permits all authenticated users to access the application.


Not read yet

The Role of AD FS in Modern Compliance

For many organizations, the decision to use AD FS is driven by regulatory compliance requirements. If you are in a highly regulated industry (finance, healthcare, government), you may be required to keep all authentication traffic within your own private data center.

AD FS supports these requirements by providing:

  • Data Sovereignty: Authentication logs and identity data never leave your controlled infrastructure.
  • Granular Control: You can define complex, custom authentication policies that are specific to your security requirements.
  • Auditability: You have full access to the underlying logs, which can be exported to your compliance reporting systems.

However, remember that compliance is not just about where the data is; it is about how it is managed. An insecurely configured AD FS environment is a compliance failure, regardless of whether it is on-premises or in the cloud.


Not read yet

Summary and Key Takeaways

Implementing and managing a hybrid identity solution using AD FS is a significant undertaking that requires a deep understanding of both identity protocols and Windows Server infrastructure. It is a powerful tool for enabling SSO and securing access to applications across the hybrid cloud divide.

Key Takeaways

  1. Federation is the Bridge: AD FS enables SSO by establishing trust between a claims provider (your AD) and a relying party (the application), using standard protocols like SAML.
  2. Infrastructure Matters: AD FS is a critical service. High availability, robust monitoring, and secure certificate management are non-negotiable for a production environment.
  3. Security is Paramount: Protect your AD FS servers by using WAP in the DMZ, enforcing MFA for all external traffic, and enabling Extranet Lockout to prevent brute-force attacks.
  4. Claim Rules are the Logic: Mastering the claim rule language is essential for tailoring the identity information sent to applications. Keep your rules clean and well-documented.
  5. Automation Reduces Risk: Use PowerShell to manage your Relying Party Trusts and configuration. Automation ensures consistency and reduces the risk of errors associated with manual configuration.
  6. Plan for the Future: Regularly evaluate your need for AD FS against modern, cloud-native alternatives. As your organization grows, the operational overhead of managing on-premises identity infrastructure may eventually outweigh the benefits.
  7. Documentation is Your Best Friend: Always maintain an inventory of your applications, certificates, and claim rules. In an emergency, clear documentation will be the difference between a quick recovery and a prolonged outage.

By following these principles, you will be well-equipped to manage a secure, efficient, and reliable hybrid identity environment that supports the needs of your users and the security posture of your organization.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.