> This page location: /docs.md > /docs/management.md > /docs/atlas/management/organizations/organization-security.md > /docs/atlas/security/federated-authentication.md

> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: integrated, manual, upload-html, create-dns
-->

# Configure Federated Authentication from Microsoft Entra ID

This guide shows you how to configure federated authentication using Microsoft Entra ID as your IdP (Identity Provider).

After integrating Microsoft Entra ID and Atlas, you can use your company's credentials to log in to Atlas and other MongoDB cloud services.

**Note:**

Atlas now supports SSO (Single Sign-On) for database users through [Authentication and Authorization with OIDC/OAuth 2.0.](https://www.mongodb.com/docs/atlas/security-oidc.md#std-label-oidc-authentication-authorization)

## Required Access

To manage federated authentication, you must have [`Organization Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Owner) access to one or more organizations that are delegating federation settings to the instance.

## Prerequisites

To use Microsoft Entra ID as an IdP (Identity Provider) for Atlas, you must have:

- An Azure (Microsoft Azure) subscription. To obtain a subscription, visit the [Microsoft Azure portal.](https://azure.microsoft.com/en-us/free/)

- An Microsoft Entra ID tenant associated with your subscription. For information about setting up an Microsoft Entra ID tenant, see the [Microsoft Entra ID Documentation.](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-create-new-tenant)

- At least `Cloud App Administrator` and `User Administrator` privileges in your Microsoft Entra ID tenant.

- A custom, routable domain name.

## Procedures

Throughout the following procedure, it is helpful to have one browser tab open to your [Atlas Federation Management Console](https://www.mongodb.com/docs/atlas/security/federated-authentication.md#std-label-atlas-federated-authentication) and one tab open to your Azure (Microsoft Azure) console.

### Add domain users

If you haven't already, use the Azure (Microsoft Azure) console to add your custom domain name to Microsoft Entra ID and create users:

1. Add your custom domain to Microsoft Entra ID.

   Add your custom domain name to Microsoft Entra ID to create users that belong to your domain. After you add your domain, you must also add the Microsoft Entra ID DNS information in a `TXT` record with your DNS provider and verify the configuration.

   To add your custom domain to Microsoft Entra ID, see the [Azure documentation.](https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/add-custom-domain)

2. Create Microsoft Entra ID Users.

   If they don't exist already, create users in Microsoft Entra ID that you want to grant access to. Users must belong to the custom domain you added to Microsoft Entra ID.

   To create Microsoft Entra ID users, see the [Azure documentation.](https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/add-users-azure-active-directory)

### Configure Microsoft Entra ID as an Identity Provider

Use the Azure (Microsoft Azure) console to configure Microsoft Entra ID as a SAML (Security Assertion Markup Language) IdP (Identity Provider). You can either add the MongoDB Cloud app from the Gallery or configure an application manually.

### Use the MongoDB Cloud Gallery App

1. Add the MongoDB Cloud app from the gallery.

   To add the MongoDB Cloud app to your Microsoft Entra ID tenant, see the [Azure documentation.](https://docs.microsoft.com/en-us/azure/active-directory/saas-apps/mongodb-cloud-tutorial#adding-mongodb-cloud-from-the-gallery)

   **See also:**

   [MongoDB Cloud on the Azure Marketplace](https://marketplace.microsoft.com/en-us/marketplace/apps?search=MongoDB)

2. Assign users to the application.

   Assign users to the application. These users will have access to Atlas and other MongoDB cloud services when you complete the tutorial.

   To assign Microsoft Entra ID users to an application, see the [Azure documentation.](https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/assign-user-or-group-access-portal#assign-users-or-groups-to-an-app-via-the-azure-portal)

3. Navigate to the SAML configuration page to begin configuring single sign-on.

   To navigate to the SAML (Security Assertion Markup Language) configuration page, see the [Azure documentation.](https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/configure-single-sign-on-non-gallery-applications#step-1-edit-the-basic-saml-configuration)

4. Set temporary values for the Identifier and Reply URL.

   To generate a valid SAML (Security Assertion Markup Language) signing certificate, you must assign temporary values to the Identifier and Reply URL for your Microsoft Entra ID enterprise application. If you download the certificate before setting these values, the downloaded certificate won't be unique and you must download the certificate again after setting these values.

   To set the temporary values:

   Click Edit in Section 1.

   Remove any existing default values and set the following temporary values:

   | Setting | Temporary Value |
   | --- | --- |
   | Identifier (Entity ID) | `https://www.okta.com/saml2/service-provider/MongoDBCloud` |
   | Reply URL (Assertion Consumer Service URL). | `https://auth.mongodb.com/sso/saml2/` |

   Click Save.

   Refresh the browser page to ensure that the certificate is regenerated.

   The certificate's thumbprint and expiration date change from the values they held after the temporary Identifier and Reply URL (Uniform Resource Locator) are updated for the first time.

5. Download the SAML signing certificate encoded in `Base64`.

   In the SAML Signing Certificate section, click Download next to Certificate (Base64).

   You upload this signing certificate to the MongoDB Federation Management Console later in the tutorial.

6. Optional: Add group claims to the SAML token.

   Skip this step if you won't use [role mapping.](https://www.mongodb.com/docs/atlas/security/manage-role-mapping.md#std-label-atlas-manage-fed-auth-roles)

   To use role mapping, add the following group claim to the SAML (Security Assertion Markup Language) token Microsoft Entra ID sends to Atlas:

   Click Add a group claim. Azure displays the Group Claims panel.

   In Which groups associated with the user should be
   returned in the claim?, click Security groups.

   What groups you select depend on the type of groups you configured in your Azure environment. You may need to select a different type of group to send the appropriate group information.

   From the Source attribute dropdown menu, select Group Id or another source attribute.

   If you select Group Id, Azure sends the security group's Object ID and not the human-readable group name.

   Entra ID supports writing group names in the `memberOf` claim instead of GUIDs. To configure Entra ID to send group names, select a different source attribute that emits the cloud-only group display name. For more information, see [Configure group claims for applications by using Microsoft Entra ID.](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-fed-group-claims)

   **Important:**

   When creating role mappings in Atlas, the role mapping name must match the source attribute Azure (Microsoft Azure) sends in the SAML (Security Assertion Markup Language) response.

   If you selected Group Id as the source attribute, the role mapping name in Atlas must be the security group's `objectId` for the role mapping to function properly.

   Click Customize the name of the group claim in the Advanced options section.

   Set Name to **memberOf**.

   Leave Namespace blank.

   Clear Emit groups as role claims.

   Click Save.

7. Copy the values of the Login URL and Microsoft Entra ID fields.

   Paste these values into a text editor or another easily accessible location.

   You enter these values in the MongoDB Federation Management Console later in the tutorial.

### Add Microsoft Entra ID as an Identity Provider in Atlas

Use the Federation Management Console and the Azure (Microsoft Azure) console to add Microsoft Entra ID as an IdP (Identity Provider):

1. In Atlas, go to the Federation Management console for your organization.

   If it's not already displayed, select your desired organization from the  Organizations menu in the navigation bar.

   In the sidebar, click Federation under the Identity & Access heading.

   Click Open Federation Management App.

   The [Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Ffederation) page displays.

2. Add Microsoft Entra ID to Atlas as an Identity Provider.

   Click Configure Identity Providers.

   If you do not have any Identity Providers configured yet, click Setup Identity Provider. Otherwise, on the Identity Providers screen, click Add Identity Provider.

   Enter or select the following SAML (Security Assertion Markup Language) Protocol Settings. All fields are required:

   | Field | Description |
   | --- | --- |
   | Configuration Name | Descriptive name, such as `Microsoft Entra ID`. |
   | IdP Issuer URI | Microsoft Entra ID Identifier you copied from Azure (Microsoft Azure) earlier in the tutorial. |
   | IdP Single Sign-On URL | Login URL that you copied from Azure (Microsoft Azure) earlier in the tutorial. |
   | IdP Signature Certificate | `Base64`-encoded SAML (Security Assertion Markup Language) signing certificate you downloaded from Azure (Microsoft Azure) earlier in the tutorial. You can either: Upload the certificate from your computer, or; Paste the contents of the certificate into a text box. |
   | Request Binding | HTTP POST. |
   | Response Signature Algorithm | SHA-256. |

   Click Next.

3. Download the metadata file with details that recognize MongoDB as a Service Provider.

   Click Download metadata. You upload this file to Microsoft Entra ID in the next step.

   Click Finish.

4. Upload the metadata file to Azure (Microsoft Azure) to finish configuring Microsoft Entra ID as an IdP (Identity Provider).

   To upload the file, see the screenshot in step 3 of [Enable single sign-on for an app](https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/add-application-portal-setup-sso#enable-single-sign-on-for-an-app) in the Azure (Microsoft Azure) documentation. Click Upload metadata file on the SSO configuration page, as shown in the screenshot in the linked Azure (Microsoft Azure) documentation.

   Optionally, add a RelayState URL to your IdP (Identity Provider) to send users to a URL you choose and avoid unnecessary redirects after login. You can use:

   | Destination | RelayState URL |
   | --- | --- |
   | MongoDB Atlas | Login URL generated for your identity provider configuration in the Atlas [Federation Management App.](https://www.mongodb.com/docs/atlas/security/federated-authentication.md#std-label-federation-management-access) |
   | MongoDB Support Portal | `https://auth.mongodb.com/app/salesforce/exk1rw00vux0h1iFz297/sso/saml` |
   | MongoDB University | `https://auth.mongodb.com/home/mongodb_thoughtindustriesstaging_1/0oadne22vtcdV5riC297/alndnea8d6SkOGXbS297` |
   | MongoDB Community Forums | `https://auth.mongodb.com/home/mongodbexternal_communityforums_3/0oa3bqf5mlIQvkbmF297/aln3bqgadajdHoymn297` |
   | MongoDB Feedback Engine | `https://auth.mongodb.com/home/mongodbexternal_uservoice_1/0oa27cs0zouYPwgj0297/aln27cvudlhBT7grX297` |
   | MongoDB JIRA | `https://auth.mongodb.com/app/mongodbexternal_mongodbjira_1/exk1s832qkFO3Rqox297/sso/saml` |

#### Map your Domain

Mapping your domain to the IdP (Identity Provider) lets Atlas know that users from your domain should be directed to the Login URL for your identity provider configuration.

When users visit the Atlas login page, they enter their email address. If the email domain is associated with an IdP, they are sent to the Login URL for that IdP.

**Important:**

When you map a single domain to multiple identity providers, users who log in using the MongoDB Cloud console are automatically redirected to the IdP (Identity Provider) associated with the first SAML (Security Assertion Markup Language) IdP (Identity Provider) application that was configured for Atlas.

To use an alternative identity provider, users must log in through either an SP-initiated or IdP-initiated login URL.

Use the Federation Management Console to map your domain to the IdP (Identity Provider):

1. In Atlas, go to the Federation Management console for your organization.

   If it's not already displayed, select your desired organization from the  Organizations menu in the navigation bar.

   In the sidebar, click Federation under the Identity & Access heading.

   Click Open Federation Management App.

   The [Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Ffederation) page displays.

2. Enter domain mapping information.

   Click Add a Domain.

   On the Domains screen, click Add Domain.

   Enter the following information for your domain mapping:

   | Field | Description |
   | --- | --- |
   | Display Name | Label to easily identify the domain. |
   | Domain Name | [Domain name](https://en.wikipedia.org/wiki/Domain_name) to map. |

   Click Next.

3. Choose your domain verification method.

   **Note:**

   You can choose the verification method once. It cannot be modified. To select a different verification method, delete and recreate the domain mapping.

   Select the appropriate tab based on whether you are verifying your domain by uploading an HTML (Hypertext Markup Language) file or creating a DNS (Domain Name System) TXT record:

   ### Upload HTML File

   Upload an HTML (Hypertext Markup Language) file containing a verification key to verify that you own your domain.

   Click HTML File Upload.

   Click Next.

   Download the `mongodb-site-verification.html` file that Atlas provides.

   Upload the HTML (Hypertext Markup Language) file to a web site on your domain. You must be able to access the file at `<https://host.domain>/mongodb-site-verification.html`.

   Click Finish.

4. Verify your domain.

   The Domains screen displays both unverified and verified domains you've mapped to your IdP (Identity Provider). To verify your domain, click the target domain's Verify button. Atlas shows whether the verification succeeded in a banner at the top of the screen.

5. Delete the provided record file.

   **Important:**

   To avoid a potential security vulnerability, delete the provided record file after verification completes.

#### Associate Your Domain with Your Identity Provider

After successfully verifying your domain, use the Federation Management Console to associate the domain with Microsoft Entra ID:

1. Click Identity Providers in the left navigation.

2. For the IdP (Identity Provider) you want to associate with your domain, click  Edit next to Associated Domains.

3. Select the domain you want to associate with the IdP (Identity Provider).

4. Click Confirm.

#### Test Your Domain Mapping

**Important:**

Before you begin testing, copy and save the [Bypass SAML Mode](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-bypass-saml) URL (Uniform Resource Locator) for your IdP (Identity Provider). Use this URL to bypass federated authentication in the event that you are locked out of your Atlas organization.

While testing, keep your session logged in to the Federation Management Console to further ensure against lockouts.

To learn more about Bypass SAML Mode, see [Bypass SAML Mode.](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-bypass-saml)

Use the Federation Management Console to test the integration between your domain and Microsoft Entra ID:

1. In a private browser window, navigate to the Atlas log in page.

2. Enter a username (usually an email address) with your verified domain.

   **Example:**

   If your verified domain is `mongodb.com`, use an email address of the form `username@mongodb.com`.

3. Click Next. If you mapped your domain correctly, you'll be redirected to your IdP (Identity Provider) to authenticate. Upon successful authentication, you'll be redirected back to Atlas.

   **Note:**

   You can bypass the Atlas log in page by navigating directly to your IdP (Identity Provider) Login URL.

### (Optional) Map an Organization

Use the Federation Management Console to assign your domain's users access to specific Atlas organizations:

1. In Atlas, go to the Federation Management console for your organization.

   If it's not already displayed, select your desired organization from the  Organizations menu in the navigation bar.

   In the sidebar, click Federation under the Identity & Access heading.

   Click Open Federation Management App.

   The [Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Ffederation) page displays.

2. Connect an organization to the Federation Application.

   Click Link Organizations.

   Atlas displays all organizations where you are an [`Organization Owner`.](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Owner)

   Organizations which are not already connected to the Federation Application have Configure Access button in the Actions column.

   Click the desired organization's Configure Access button.

3. Apply an Identity Provider to the organization.

   On the Identity Provider screen, click Connect Identity Provider.

   Atlas directs you to the Identity Providers screen which shows all IdPs (Identity Providers) you have linked to Atlas.

   For the IdP (Identity Provider) you want to apply to the organization, click Connect.

   In the Apply Identity Provider to Organizations modal, select the organizations to which this IdP (Identity Provider) applies.

   Click Confirm.

4. Connect an organization to the Federation Application.

   Click Linked Organizations in the left navigation.

   In the list of Organizations, ensure that your desired organizations now have the expected Identity Provider.

### (Optional) Configure Advanced Federated Authentication Options

You can configure the following advanced options for federated authentication for greater control over your federated users and authentication flow:

- [Bypass SAML Mode](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-bypass-saml)

**Note:**

The following advanced options for federated authentication require you to [map an organization.](https://www.mongodb.com/docs/atlas/security/federated-auth-azure-ad.md#std-label-azure-ad-map-org)

- [Assign a Default User Role for an Organization](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-advanced-option-default-role)

- [Restrict Access to an Organization by Domain](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-restrict-org-access-by-domain)

- [Restrict User Membership to the Federation](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-restrict-fed-user-membership)

## Sign in to Atlas Using Your Login URL

All users that you assign to the Microsoft Entra ID application can log in to Atlas using their Microsoft Entra ID credentials on the Login URL. Users have access to the organizations you mapped to your IdP (Identity Provider).

**Important:**

When you map a single domain to multiple identity providers, users who log in using the MongoDB Cloud console are automatically redirected to the IdP (Identity Provider) associated with the first SAML (Security Assertion Markup Language) IdP (Identity Provider) application that was configured for Atlas.

To use an alternative identity provider, users must log in through either an SP-initiated or IdP-initiated login URL.

If you select a default organization role, new users who log in to Atlas using the Login URL have the role you specify
