Add Microsoft Entra ID as a SAML connection
Before you start
Clerk supports Enterprise SSO via the SAML protocol, enabling you to create authentication strategies for an Identity Provider (IdP).
When you configure a SAML connection with Microsoft Entra ID (formerly Azure Active Directory) as your IdP, your users can sign up and sign in to your application with their Microsoft account. In this guide, you configure the connection in the Clerk Dashboard, while the customer (whoever manages the Microsoft Entra ID application) configures it on the Microsoft side.
Create a Microsoft Entra ID SAML connection in Clerk
- In the Clerk Dashboard, navigate to the SSO connections page.
- Select Add connection and select For specific domains or organizations.
- Under SAML, select Microsoft Entra ID (Formerly AD).
- Enter the Domain. This is the email domain of the users you want to allow to sign in to your application. Optionally, select an Organization.
- Enter the Name. This will be displayed on the sign-in form.
- Select Add connection. You'll be redirected to the connection's configuration page. Note that the connection is disabled by default.
- In the Service Provider Configuration section, save the Reply URL (Assertion Consumer Service URL) and Identifier (Entity ID) values somewhere secure. You'll need to give these to the customer so they can configure their Microsoft Entra ID application.
Configure SAML application
Now that the enterprise connection is configured in Clerk and the Reply URL and Identifier are known, the customer's Microsoft application needs to be configured. At a high level, the process is:
- Create a new enterprise application in Microsoft Azure and assign users or groups.
- Add the Reply URL and Identifier from Clerk to the application's SAML configuration.
- Configure the attribute claims.
- Share the application's App Federation Metadata URL.
To get you started, you can use the following email template with detailed instructions. Remember to share the Reply URL and Identifier (Entity ID):
Add App Federation Metadata URL in the Clerk Dashboard
After following the instructions in the email, your customer should have sent you the Microsoft app's App Federation Metadata URL. Now, you're going to add it to the Clerk connection, completing the SAML connection configuration.
- Navigate to the SSO connections page in the Clerk Dashboard.
- Select the SAML connection.
- In the Identity Provider Configuration section, under App Federation Metadata Url, paste the App Federation Metadata URL.
- Select Fetch & save. Keep the page open for the next step.
Map IdP claims to Clerk fields
Clerk automatically maps the standard SAML claims (email, first name, and last name) to the User object. To review them, open the connection's SSO tab and find the Common attributes section under Attribute mapping.
To map a claim that has no standard Clerk field, store it in the user's publicMetadata. The approach depends on whether the connection also uses Directory Sync:
- SSO only: In the IdP, prefix the claim name with
public_metadata_. For example, mapping a phone number topublic_metadata_phone_numberstores it underphone_numberinUser.publicMetadata. Some IdPs, such as Microsoft Entra, send claims as URLs; map those as plain strings. - SSO with Directory Sync: Define a custom attribute so the mapping applies to both SSO and SCIM. Define it on the connection's Overview tab (in the Identity provider attributes section), then map it in the SSO tab (in the Custom attributes section of the Attribute mapping section). Refer to the guide on custom attribute mapping. While Directory Sync is enabled, SCIM is the only source for these values and overrides SSO.
Learn more about accessing user metadata from the API.
Enable the connection in Clerk
You have configured the SAML connection. Once enabled, all users with email addresses ending in the domain will be redirected to your identity provider at sign-up and sign-in.
To make the connection available for your users to authenticate with:
- Navigate to the SSO connections page and select the connection.
- At the top of the page, toggle on Enable connection and select Save.
Feedback
Last updated on