Microsoft Entra ID
You can integrate Microsoft Entra ID (formerly Azure Active Directory) with Cloudflare Zero Trust and build policies based on user identity and group membership. Users will authenticate to Zero Trust using their Entra ID credentials.
The following Entra ID values are required to set up the integration:
- Application (client) ID
- Directory (tenant) ID
- Client secret
To retrieve those values:
-
Log in to the Azure dashboard ↗.
-
Go to All services > Microsoft Entra ID.
-
In the sidebar, go to Manage > Enterprise applications.
-
Select New application, then select Create your own application.
-
Name your application.
-
Select Register an application to integrate with Microsoft Entra ID (App you’re developing) and then select Create.
-
Under Redirect URI, select the Web platform and enter the following URL:
You can find your team name in Zero Trust under Settings > Custom Pages.
-
Select Register.
-
Next, return to Microsoft Entra ID and go to go to Manage > App registrations.
-
Select the app you just created. Copy the Application (client) ID and Directory (tenant) ID.
-
Under Client credentials, go to Add a certificate or secret. Select New client secret.
-
Name the client secret and choose an expiration period.
-
After the client secret is created, copy its Value field. Store the client secret in a safe place, as it can only be viewed immediately after creation.
-
From the App registrations page for your application, go to API permissions.
-
Select Add a permission.
-
Select Microsoft Graph.
-
Select Delegated permissions and enable the following permissions ↗:
email
offline_access
openid
profile
User.Read
Directory.Read.All
GroupMember.Read.All
-
Once all seven permissions are enabled, select Add permissions.
-
Select Grant admin consent.
-
In Zero Trust ↗, go to Settings > Authentication.
-
Under Login methods, select Add new.
-
Select Azure AD.
-
Enter the Application (client) ID, Client secret, and Directory (tenant) ID obtained from Microsoft Entra ID.
-
(Optional) Configure the following settings:
- Proof Key for Code Exchange: Perform PKCE ↗ on all login attempts.
- Support Groups: Allow Cloudflare to read a user’s Entra ID group membership.
- Entra ID Policy Sync: Refer to our Entra ID Conditional Access tutorial.
- Enable SCIM: Refer to Synchronize users and groups.
- Email claim: Enter the Entra ID claim that you wish to use for user identification (for example,
preferred_username
). - OIDC Claims: Enter custom OIDC claims that you wish to add to your users’ identity. This information will be available in the user identity endpoint.
-
Select Save.
To test that your connection is working, select Test.
The Microsoft Entra ID integration allows you to synchronize IdP groups and automatically deprovision users using SCIM.
- Microsoft Entra ID P1 or P2 license
-
In Zero Trust ↗, go to Settings > Authentication.
-
Locate the IdP you want to synchronize and select Edit.
-
Select Enable SCIM and Support groups.
-
(Optional) Enable the following settings:
- Enable user deprovisioning: Revoke a user’s active session when they are removed from the SCIM application in the IdP. This will invalidate all active Access sessions and prompt for reauthentication for any Gateway WARP session policies.
- Remove user seat on deprovision: Remove a user’s seat from your Zero Trust account when they are removed from the SCIM application in the IdP.
- Enable group membership change reauthentication: Revoke a user’s active session when their group membership changes in the IdP. This will invalidate all active Access sessions and prompt for reauthentication for any Gateway WARP session policies. Access will read the user’s updated group membership when they reauthenticate.
-
Select Save.
-
Copy the SCIM Endpoint and SCIM Secret. You will need to enter these values into the IdP.
The SCIM secret never expires, but you can manually regenerate the secret at any time.
-
In the Microsoft Entra ID menu, go to Enterprise applications.
-
Select New application > Create your own application.
-
Name your application (for example,
Cloudflare Access SCIM
). -
Select Integrate any other application you don’t find in the gallery (Non-gallery).
-
Once the SCIM application is created, assign users and groups to the application ↗.
-
Go to Provisioning and select Get started.
-
For Provisioning Mode, choose Automatic.
-
In the Tenant URL field, enter the SCIM Endpoint obtained from Zero Trust.
-
In the Secret Token field, enter the SCIM Secret obtained from Zero Trust.
-
Select Test Connection to ensure that the credentials were entered correctly.
-
Select Save.
-
On the Provisioning page, select Start provisioning. You will see the synchronization status in Entra ID.
To check which users and groups were synchronized, select View provisioning logs.
Provisioning attributes define the user properties that Entra ID will synchronize with Cloudflare Access. To modify your provisioning attributes, go to the Provisioning page in Entra ID and select Edit attribute mappings.
We recommend enabling the following user attribute mappings:
customappsso Attribute | Entra ID Attribute | Recommendation |
---|---|---|
emails[type eq "work"].value | mail | Required |
name.givenName | givenName | Recommended |
name.familyName | surname | Recommended |
When SCIM synchronization is enabled, your Entra group names will automatically appear in the Access and Gateway policy builders.
If building a Gateway policy, choose the User Group Names selector.
You can create Access and Gateway policies for groups that are not synchronized with SCIM. Entra ID exposes directory groups in a format that consists of random strings, the Object Id
, that is distinct from the Name
.
-
Make sure you enable Support groups as you set up Microsoft Entra ID in Zero Trust.
-
On your Azure dashboard, note the
Object Id
for the Entra group. In the example below, the group named Admins has an ID of61503835-b6fe-4630-af88-de551dd59a2
. -
If building an Access policy, choose the Azure Groups selector. If building a Gateway policy, choose the User Group IDs selector.
-
In the Value field, enter the
Object Id
for the Entra group.
Access and Gateway policies for an Entra group will also apply to all nested groups ↗. For example, if a user belongs to the group US devs
, and US devs
is part of the broader group Devs
, the user would be allowed or blocked by all policies created for Devs
.
You can require users to re-enter their credentials into Entra ID whenever they re-authenticate their WARP session. To configure this setting, make a PUT
request and set the prompt
parameter to either login
or select_account
.