Microsoft Azure AD®
You can integrate Microsoft Azure AD® (Active Directory) with Cloudflare Zero Trust and build policies based on user identity and group membership. Users will authenticate to Zero Trust using their Azure AD credentials.
Set up Azure AD as an identity provider
1. Obtain Azure AD settings
The following Azure AD 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.
Navigate to All services > Azure Active Directory.
In the Azure Active Directory menu, go to Enterprise applications.
Select New application > Create your own application.
Name your application.
Select Register an application to integration with Azure AD (App you’re developing) and then select Create.
Under Redirect URI, select the Web platform and enter the following URL:
https://<your-team-name>.cloudflareaccess.com/cdn-cgi/access/callbackYou can find your team name in Zero Trust under Settings > General.
Select Register.
Next, return to the Azure Active Directory menu and go to App registrations.
Select the app you just created. Copy the Application (client) ID and Directory (tenant) ID.
Navigate to Certificates & secrets and 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.
2. Configure API permissions in Azure
From the App registrations page for your application, navigate 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.
3. Add Azure AD as an identity provider
In Zero Trust, navigate 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 the Azure dashboard.
(Optional) Enable Proof of Key Exchange (PKCE). PKCE will be performed on all login attempts.
(Optional) If you are using Azure AD groups, enable Support Groups.
Select Save.
To test that your connection is working, select Test.
Synchronize users and groups
The Azure AD integration supports the System for Cross-domain Identity Management (SCIM) protocol. With SCIM, Cloudflare Access can automatically deprovision users after they are deactivated in the identity provider and display synchronized group names in the Access policy builder.
To synchronize users and groups between Access and Azure:
1. Enable SCIM in Zero Trust
In Zero Trust, go to Settings > Authentication.
Locate the IdP you want to synchronize and select Edit.
Select Support groups and Enable SCIM.
(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.
- 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 revoke 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.
2. Configure SCIM in Azure
In the Azure Active Directory 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.
Navigate 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 Azure.
To check which users and groups were synchronized, select View provisioning logs.
Azure groups in Zero Trust policies
Automatic entry
When SCIM synchronization is enabled, the Azure group names will appear in the Values dropdown when you choose the Azure Groups selector.
Manual entry
You can create Access and Gateway policies for groups that are not synchronized with SCIM. Azure AD 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 Azure AD in Zero Trust.
On your Azure dashboard, note the
Object Id
for the Azure 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 Azure group.
Nested groups
Access and Gateway policies for an Azure 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
.
Example API Configuration
{ "config": { "client_id": "<your client id>", "client_secret": "<your client secret>", "directory_id": "<your azure directory uuid>", "support_groups": true }, "type": "azureAD", "name": "my example idp"
}