Connect to Azure AD using an OIDC Enterprise Connection
This article provides instructions for configuring an OpenID Connect (OIDC) Enterprise connection to Azure Active Directory (AD). While Auth0 offers a dedicated Azure AD connection type, a generic OIDC Enterprise connection can also be used.
-
Azure Active Directory (AD)
-
Enterprise Connections
-
OpenID Connect (OIDC)
Using a generic OIDC Enterprise connection for Azure AD offers several advantages over the dedicated Azure AD connection type:
- It does not require a client secret, which simplifies configuration.
- It allows for the use of other Azure AD National Cloud instances. For more information, refer to Microsoft Entra authentication & national clouds.
- It accepts any custom claim included in the ID Token, allowing for greater flexibility in mapping claims to the Auth0 user profile.
The connection uses the Implicit grant by default, requesting an ID Token with response_mode=form_post. To inspect the token that Azure AD provides, use the browser's developer tools to find the POST to https://<auth0_domain>/login/callback. The token can be decoded using a tool such as jwt.io.
Please watch the video or the steps below:
Configure Azure AD
These steps configure an application registration for single-tenant applications, where only users from the same directory can log in.
- In Azure AD, create a new application registration.
- For the Redirect URI, select Web as the type and enter
https://<tenant_domain>/login/callback. The tenant’s domain can be found by checking any application created in Auth0.
NOTE: If using a custom domain, add a second Redirect URI later, after creating the app. - Select the Register button.
- From the confirmation page, copy the Application (client) ID for later use.
-
Select the Endpoints button and copy the OpenID Connect metadata document URL. The URL format is h
ttps://login.microsoftonline.com/<Directory (Tenant) ID>/v2.0/.well-known/openid-configuration. -
Navigate to the Authentication section.
-
Under Implicit grant and hybrid flows, select the ID tokens checkbox.
- If using a custom domain with Auth0, add a second Redirect URI in the
https://<your_custom_domain>/login/callbackformat.
-
Click the Save button.
-
Navigate to the Token configuration section.
-
Click Add optional claim.
-
Select ID.
-
Select email, family_name, and given_name, along with any other required claims. Select Add.
-
When prompted, accept the request for Microsoft Graph permissions.
-
Optionally, click Add groups claim to include group information in the ID Token.
-
Navigate to the Certificates & Secrets section.
-
Select New Client Secret
-
Copy the Client Secret Value, not the Secret ID.
Steps on Auth0
- In the Auth0 Dashboard, navigate to Authentication > Enterprise.
- Select OpenID Connect and click Create Connection.
- Enter a Connection name.
- In the Issuer URL field, paste the OpenID Connect metadata document URL copied from Azure AD.
- In the Client ID field, paste the Application (client) ID copied from Azure AD.
- Select Create.
- Select the Applications tab for the new connection and enable the connection for at least one application.
- Once the settings are saved, return to the list of OIDC Enterprise connections, click the three dots to the right of the new connection, and select Try to test the connection. Auth0 stores all claims included in the ID Token from Azure AD in the user's profile.