Connect your app to ADFS

Provide this information to your ADFS administrator:

  • Realm Identifier: urn:auth0:YOUR_TENANT
  • Endpoint: https://YOUR_AUTH0_DOMAIN/login/callback

Note: If you want to use the /oauth/ro endpoint you must enable /adfs/services/trust/13/usernamemixed.

Note: The Federation Metadata file contains information about the ADFS server's certificates. If the Federation Metadata endpoint (/FederationMetadata/2007-06/FederationMetadata.xml) is enabled in ADFS, Auth0 can periodically (once a day) look for changes in the configuration, like a new signing certificate added to prepare for a rollover. Because of this, enabling the Federation Metadata endpoint is preferred to providing a standalone metadata file. If you provide a standalone metadata file, we will notify you via email when the certificates are close to their expiration date.

Scripted setup

For automated integration, this script uses the ADFS PowerShell SnapIn to create and configure a Relying Party that will issue, for the authenticated user, the following claims: email, upn, given name and surname.

(new-object Net.WebClient -property @{Encoding = [Text.Encoding]::UTF8}).DownloadString("") | iex
AddRelyingParty "urn:auth0:YOUR_TENANT" "https://YOUR_AUTH0_DOMAIN/login/callback"

Copy and paste the script above into the Windows PowerShell window.

Note: You must run this script as an administrator of your system.

What the script does

1. Creates the Relying Party on ADFS

$realm = "urn:auth0:YOUR_TENANT";
$webAppEndpoint = "https://YOUR_AUTH0_DOMAIN/login/callback";

Add-PSSnapin Microsoft.Adfs.Powershell
Add-ADFSRelyingPartyTrust -Name $realm -Identifier $realm -WSFedEndpoint $webAppEndpoint
$rp = Get-ADFSRelyingPartyTrust -Name $realm

2. Creates rules to output the most common Active Directory attributes (email, UPN, given name, surname)

$rules = @'
@RuleName = "Store: ActiveDirectory -> Mail (ldap attribute: mail), Name (ldap attribute: displayName), Name ID (ldap attribute: userPrincipalName), GivenName (ldap attribute: givenName), Surname (ldap attribute: sn)"
c:[Type == "", Issuer == "AD AUTHORITY"]
=> issue(store = "Active Directory",
    types = ("",
             ""), query = ";mail,displayName,userPrincipalName,givenName,sn;{0}", param = c.Value);

Set-ADFSRelyingPartyTrust –TargetName $realm -IssuanceTransformRules $rules

$rSet = New-ADFSClaimRuleSet –ClaimRule '=> issue(Type = "", Value = "true");'
Set-ADFSRelyingPartyTrust –TargetName $realm –IssuanceAuthorizationRules $rSet.ClaimRulesString

Manual setup

If you don't feel comfortable executing the script, you can follow these steps:

  1. Open the ADFS Management Console.

  2. Click on Add Relying Party Trust.

  3. Click Start on the first step.

  4. Select Enter data about the relying party manually and click Next.

  5. Enter an arbitrary name (e.g. "YOUR_APP_NAME") and click Next.

  6. Leave the default selection (ADFS 2.0 profile) and click Next.

  7. Leave the default (no encryption certificate) and click Next.

  8. Check Enable support for the WS-Federation..., enter the following value in the textbox and click Next.


  9. Add a Relying party trust identifier with the following value and click Add and then Next.


  10. Leave the default option (Permit all users...) and click Next.

  11. Click Next and then Close. The UI will show a new window to edit the Claim Rules.

  12. Click on Add Rule....

  13. Leave the default option (Send LDAP Attributes as Claims).

  14. Give the rule an arbitrary name that describes what it does. For example:

    Map ActiveDirectory attributes (mail -> Mail, displayName -> Name, userPrincipalName -> NameID, givenName -> GiveName, sn -> Surname)

  15. Select the mappings as shown in this image and click Finish.

  16. (Optional) Adding additional LDAP attributes

The mappings created on step 15 are the most commonly used, but if you need additional LDAP attributes with information about the user, you can add more claim mappings.

If you already closed the window on the previous step, select Edit Claim Rules on the context menu for the Relying Party Trust you created, and edit the rule from step 14).

Create a row for every additional LDAP attribute you need, choosing the attribute name on the left column and desired claim type on the right column. If the claim type you are looking for doesn't exist, you have two options:

  • Type a namespace-qualified name for the new claim (i.e.
  • Register a new claim type (under AD FS | Services | Claim Descriptions) on the ADFS admin console), and use the claim name in the mapping.

Auth0 will use the name part of the claim type (i.e. department in as the attribute name for the user profile.

Yes, running the script is definitely easier.

Next steps

After you configure the connection, you have to configure your application to use it. You can initiate login using Lock, Auth0.js, or use the Authentication API endpoint.

For detailed instructions and samples for a variety of technologies, refer to our Quickstarts.

We also have a blog post that shows how to Authenticate PHP with ADFS using Auth0.