CG
SkillsBuilding Identity Federation with SAML Azure AD
Start Free
Back to Skills Library
Identity & Access Management๐ŸŸก Intermediate

Building Identity Federation with SAML Azure AD

Establish SAML 2.0 identity federation between on-premises Active Directory and Azure AD (Microsoft Entra ID) for seamless cross-domain authentication and SSO to cloud applications.

4 min read5 code examples

Prerequisites

  • On-premises Active Directory domain
  • AD FS 2019+ or third-party SAML IdP (Okta, Ping, etc.)
  • Microsoft Entra ID tenant (P1 or P2 license recommended)
  • Azure AD Connect (if using hybrid identity with password hash sync as backup)
  • Public TLS certificate for federation endpoint
  • DNS records for federation service name

Building Identity Federation with SAML Azure AD

Overview

Identity federation enables users authenticated by one identity provider to access resources managed by another without maintaining separate credentials. This guide covers establishing SAML 2.0 federation between an organization's on-premises Active Directory (via AD FS or third-party IdP) and Microsoft Entra ID (formerly Azure AD), as well as configuring federated SSO for third-party SaaS applications. Federation eliminates password synchronization concerns and keeps authentication authority on-premises while extending SSO to cloud resources.

Prerequisites

  • On-premises Active Directory domain
  • AD FS 2019+ or third-party SAML IdP (Okta, Ping, etc.)
  • Microsoft Entra ID tenant (P1 or P2 license recommended)
  • Azure AD Connect (if using hybrid identity with password hash sync as backup)
  • Public TLS certificate for federation endpoint
  • DNS records for federation service name

Core Concepts

Federation Models

ModelAuthentication AuthorityUse Case
Federated (AD FS)On-premises AD FSRegulatory requirement to keep auth on-prem
Managed (PHS)Azure AD with password hash syncSimplest cloud auth, AD FS not needed
Managed (PTA)On-premises via pass-through agentCloud auth validated against on-prem AD
Third-Party FederationExternal IdP (Okta, Ping)Multi-IdP environment

SAML Federation Architecture

User โ†’ Cloud App (SP)
   โ”‚
   โ””โ”€โ”€ Redirect to Azure AD
          โ”‚
          โ”œโ”€โ”€ Azure AD checks federated domain
          โ”‚
          โ””โ”€โ”€ Redirect to on-premises AD FS
                 โ”‚
                 โ”œโ”€โ”€ AD FS authenticates against Active Directory
                 โ”‚
                 โ”œโ”€โ”€ AD FS issues SAML token
                 โ”‚
                 โ””โ”€โ”€ Token posted back to Azure AD
                        โ”‚
                        โ”œโ”€โ”€ Azure AD validates federation trust
                        โ”‚
                        โ”œโ”€โ”€ Azure AD issues its own token
                        โ”‚
                        โ””โ”€โ”€ User receives access token for cloud app

Federation Trust Components

ComponentDescription
Token-Signing CertificateX.509 certificate used by IdP to sign SAML assertions
Federation MetadataXML document describing IdP endpoints and capabilities
Relying Party TrustConfiguration in AD FS for each SP (Azure AD)
Claims RulesTransform AD attributes into SAML claims
Issuer URIUnique identifier for the IdP (entity ID)

Implementation Steps

Step 1: Prepare AD FS Infrastructure

# Install AD FS role
Install-WindowsFeature ADFS-Federation -IncludeManagementTools

# Configure AD FS farm
Install-AdfsFarm `
    -CertificateThumbprint $certThumbprint `
    -FederationServiceDisplayName "Corp Federation Service" `
    -FederationServiceName "fs.corp.example.com" `
    -ServiceAccountCredential $gmsaCredential

# Verify AD FS is operational
Get-AdfsProperties | Select-Object HostName, Identifier, FederationPassiveAddress

Step 2: Configure Azure AD Federated Domain

# Install Microsoft Graph PowerShell module
Install-Module Microsoft.Graph -Scope CurrentUser

# Connect to Microsoft Graph
Connect-MgGraph -Scopes "Domain.ReadWrite.All"

# Convert managed domain to federated
# Using AD FS federation metadata URL
$domainId = "corp.example.com"
$federationConfig = @{
    issuerUri = "http://fs.corp.example.com/adfs/services/trust"
    metadataExchangeUri = "https://fs.corp.example.com/adfs/services/trust/mex"
    passiveSignInUri = "https://fs.corp.example.com/adfs/ls/"
    signOutUri = "https://fs.corp.example.com/adfs/ls/?wa=wsignout1.0"
    signingCertificate = $base64Cert
    preferredAuthenticationProtocol = "saml"
}

# Apply federation settings to domain
New-MgDomainFederationConfiguration -DomainId $domainId -BodyParameter $federationConfig

Step 3: Configure AD FS Claims Rules

# Add Relying Party Trust for Azure AD
Add-AdfsRelyingPartyTrust `
    -Name "Microsoft Office 365 Identity Platform" `
    -MetadataUrl "https://nexus.microsoftonline-p.com/federationmetadata/2007-06/federationmetadata.xml"

# Configure claim rules
$rules = @"
@RuleTemplate = "LdapClaims"
@RuleName = "Extract AD Attributes"
c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname",
   Issuer == "AD AUTHORITY"]
=> issue(store = "Active Directory",
   types = ("http://schemas.xmlsoap.org/claims/UPN",
            "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
            "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname",
            "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"),
   query = ";userPrincipalName,mail,givenName,sn;{0}",
   param = c.Value);

@RuleTemplate = "PassThroughClaims"
@RuleName = "Pass Through UPN as NameID"
c:[Type == "http://schemas.xmlsoap.org/claims/UPN"]
=> issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
   Issuer = c.Issuer, OriginalIssuer = c.OriginalIssuer,
   Value = c.Value,
   ValueType = c.ValueType,
   Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"]
       = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent");
"@

Set-AdfsRelyingPartyTrust `
    -TargetName "Microsoft Office 365 Identity Platform" `
    -IssuanceTransformRules $rules

Step 4: Configure Third-Party SaaS Federation

For each SaaS application that supports SAML SSO via Azure AD:

  1. Navigate to Microsoft Entra Admin Center > Enterprise Applications
  2. Add the application from the gallery (or create custom SAML)
  3. Configure Single Sign-On > SAML:
  • Identifier (Entity ID): Application's entity ID
  • Reply URL (ACS): Application's assertion consumer service URL
  • Sign-on URL: Application's login URL
  1. Map user attributes/claims:
  • NameID: user.userprincipalname (email format)
  • Additional claims as required by the application
  1. Download the Federation Metadata XML or certificate
  2. Configure the SaaS app with Azure AD's federation details

Step 5: Certificate Lifecycle Management

AD FS token-signing certificates expire and must be renewed:

# Check current certificate expiration
Get-AdfsCertificate -CertificateType Token-Signing | Select-Object Thumbprint, NotAfter

# AD FS supports auto-rollover (enabled by default)
Get-AdfsProperties | Select-Object AutoCertificateRollover

# If manual rotation is needed:
# 1. Add new certificate as secondary
Set-AdfsCertificate -CertificateType Token-Signing -Thumbprint $newThumbprint -IsPrimary $false
# 2. Update Azure AD with new certificate
# 3. Promote to primary
Set-AdfsCertificate -CertificateType Token-Signing -Thumbprint $newThumbprint -IsPrimary $true
# 4. Remove old certificate
Remove-AdfsCertificate -CertificateType Token-Signing -Thumbprint $oldThumbprint

Validation Checklist

  • [ ] AD FS farm operational with valid TLS and token-signing certificates
  • [ ] Azure AD domain configured as federated with correct metadata
  • [ ] Claims rules properly transform AD attributes to SAML assertions
  • [ ] Test user can authenticate through federation flow end-to-end
  • [ ] MFA enforced at AD FS or Azure AD conditional access level
  • [ ] Certificate auto-rollover enabled or manual rotation scheduled
  • [ ] Federation metadata endpoint publicly accessible
  • [ ] Smart lockout configured to prevent brute force
  • [ ] Extranet lockout policies configured on AD FS
  • [ ] Monitoring configured for AD FS health and certificate expiry
  • [ ] Disaster recovery: managed authentication fallback documented

Compliance Framework Mapping

This skill supports compliance evidence collection across multiple frameworks:

  • SOC 2: CC6.1 (Logical Access), CC6.2 (Credentials), CC6.3 (Provisioning)
  • ISO 27001: A.9.1 (Access Control), A.9.2 (User Access Management), A.9.4 (System Access Control)
  • NIST 800-53: AC-2 (Account Management), IA-2 (Identification), AC-6 (Least Privilege)
  • NIST CSF: PR.AC (Access Control)

Claw GRC Tip: When this skill is executed by a registered agent, compliance evidence is automatically captured and mapped to the relevant controls in your active frameworks.

Deploying This Skill with Claw GRC

Agent Execution

Register this skill with your Claw GRC agent for automated execution:

# Install via CLI
npx claw-grc skills add building-identity-federation-with-saml-azure-ad

# Or load dynamically via MCP
grc.load_skill("building-identity-federation-with-saml-azure-ad")

Audit Trail Integration

When executed through Claw GRC, every step of this skill generates tamper-evident audit records:

  • SHA-256 chain hashing ensures no step can be modified after execution
  • Evidence artifacts (configs, scan results, logs) are automatically attached to relevant controls
  • Trust score impact โ€” successful execution increases your agent's trust score

Continuous Compliance

Schedule this skill for recurring execution to maintain continuous compliance posture. Claw GRC monitors for drift and alerts when re-execution is needed.

References

  • Microsoft Entra Federation Documentation
  • AD FS Design Guide
  • Configure AD FS for Azure AD Federation
  • SAML 2.0 Authentication - OASIS

Use with Claw GRC Agents

This skill is fully compatible with Claw GRC's autonomous agent system. Deploy it to any registered agent via MCP, and every execution will be logged in the tamper-evident audit trail.

// Load this skill in your agent
npx claw-grc skills add building-identity-federation-with-saml-azure-ad
// Or via MCP
grc.load_skill("building-identity-federation-with-saml-azure-ad")

Tags

samlazure-adentra-idfederationidentityssoadfshybrid-identity

Related Skills

Identity & Access Management

Implementing Conditional Access Policies Azure AD

3mยทintermediate
Identity & Access Management

Implementing Google Workspace SSO Configuration

4mยทintermediate
Identity & Access Management

Implementing SAML SSO with Okta

3mยทintermediate
Identity & Access Management

Implementing Azure AD Privileged Identity Management

5mยทintermediate
Identity & Access Management

Configuring Active Directory Tiered Model

3mยทintermediate
Identity & Access Management

Configuring LDAP Security Hardening

3mยทintermediate

Skill Details

Domain
Identity & Access Management
Difficulty
intermediate
Read Time
4 min
Code Examples
5

On This Page

OverviewPrerequisitesCore ConceptsImplementation StepsValidation ChecklistReferencesCompliance Framework MappingDeploying This Skill with Claw GRC

Deploy This Skill

Add this skill to your Claw GRC agent and start automating.

Get Started Free โ†’