|
| 1 | +--- |
| 2 | +pcx_content_type: how-to |
| 3 | +title: Provision with Microsoft Entra |
| 4 | +sidebar: |
| 5 | + label: Microsoft Entra |
| 6 | +--- |
| 7 | + |
| 8 | +import { Render } from "~/components"; |
| 9 | + |
| 10 | +<Render file="idp-group-deprecation" /> |
| 11 | + |
| 12 | +## Set up the Enterprise application |
| 13 | + |
| 14 | +1. Go to your Microsoft Entra ID instance and select **Enterprise Applications**. |
| 15 | +2. Select **Create your own application** and name your application. |
| 16 | +3. Select **Integrate any other application you do not find in the gallery (Non-gallery)**. |
| 17 | +4. Select **Create**. |
| 18 | + |
| 19 | +## Provision the Enterprise application |
| 20 | + |
| 21 | +1. Under **Manage** on the sidebar menu, select **Provisioning**. |
| 22 | +2. Select **Automatic** on the dropdown menu for the Provisioning Mode. |
| 23 | +3. Enter your API token value and the tenant URL: `https://api.cloudflare.com/client/v4/accounts/<your_account_ID>/scim/v2`. |
| 24 | +4. Select **Test Connection**, then select **Save**. |
| 25 | + |
| 26 | +## Configure user & group sync in Microsoft Entra ID application |
| 27 | + |
| 28 | +1. Once the SCIM application is created, [assign users and groups to the application](https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/assign-user-or-group-access-portal?pivots=portal). |
| 29 | +2. To begin syncing your Users & Groups into Cloudflare, navigate back to **Provisioning**, and under **Provisioning Status**, check *On*, then select **Save**. |
| 30 | + |
| 31 | +:::note |
| 32 | +To successfully provision with Microsoft Entra ID, the `user principal name` and `email` fields must match. These values are case-sensitive. |
| 33 | +::: |
| 34 | + |
| 35 | +3. To validate which users and groups were synchronized, select **Provisioning logs** in Microsoft Entra. You can also check the Cloudflare dashboard Audit Logs by navigating to **Manage Account** > **Audit Log**. |
| 36 | +4. To grant permissions to Users & Groups in Cloudflare, refer to the Permission Policies guide. |
| 37 | + |
| 38 | + |
| 39 | +## (Optional) Automate Cloudflare's SCIM integration |
| 40 | + |
| 41 | +Cloudflare's SCIM integration requires one external application per account. Customers with many accounts may want to automate part of the setup to save time and reduce the amount of time spent in the Entra administrative UI. |
| 42 | + |
| 43 | +The initial setup of creating the non-gallery applications and adding the provisioning URL and API key are scriptable via API, but the rest of the setup is dependent on your specific need and IDP configuration. |
| 44 | + |
| 45 | +**1. Get an access token** |
| 46 | + |
| 47 | +Get an Entra access token. Note that the example below is using the Azure CLI. |
| 48 | + |
| 49 | +``` |
| 50 | +# Using azure-cli |
| 51 | +az login |
| 52 | +az account get-access-token --resource https://graph.microsoft.com |
| 53 | +
|
| 54 | +(payload with accessToken returned) |
| 55 | +``` |
| 56 | +**2. Create a new application via template.** |
| 57 | + |
| 58 | +The template ID 8adf8e6e-67b2-4cf2-a259-e3dc5476c621 is the suggested template to create non-gallery apps in the Entra docs. Replace `<accessToken>` and `displayName` with your values. |
| 59 | + |
| 60 | +```curl title="Example request" |
| 61 | +curl -X POST 'https://graph.microsoft.com/v1.0/applicationTemplates/8adf8e6e-67b2-4cf2-a259-e3dc5476c621/instantiate' \ |
| 62 | + --header 'Content-Type: application/json' \ |
| 63 | + --header 'Authorization: Bearer <accessToken>' \ |
| 64 | + --data-raw '{ |
| 65 | + "displayName": "Entra API create application test" |
| 66 | +}' |
| 67 | +``` |
| 68 | + |
| 69 | +```curl title="Example response" |
| 70 | +{ |
| 71 | + "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.applicationServicePrincipal", |
| 72 | + "application": { |
| 73 | + "id": "343a8552-f9d9-471c-b677-d37062117cc8", // |
| 74 | + "appId": "03d8207b-e837-4be9-b4e6-180492eb3b61", |
| 75 | + "applicationTemplateId": "8adf8e6e-67b2-4cf2-a259-e3dc5476c621", |
| 76 | + "createdDateTime": "2025-01-30T00:37:44Z", |
| 77 | + "deletedDateTime": null, |
| 78 | + "displayName": "Entra API create application test", |
| 79 | + "description": null, |
| 80 | + // ... snipped rest of large application payload |
| 81 | + }, |
| 82 | + "servicePrincipal": { |
| 83 | + "id": "a8cb133d-f841-4eb9-8bc9-c8e9e8c0d417", // Note this ID for the subsequent request |
| 84 | + "deletedDateTime": null, |
| 85 | + "accountEnabled": true, |
| 86 | + "appId": "03d8207b-e837-4be9-b4e6-180492eb3b61", |
| 87 | + "applicationTemplateId": "8adf8e6e-67b2-4cf2-a259-e3dc5476c621", |
| 88 | + "appDisplayName": "Entra API create application test", |
| 89 | + // ...snipped rest of JSON payload |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +**3. Create a provisioning job** |
| 94 | + |
| 95 | +To enable provisioning, you will also need to create a job. Note the SERVICE_PRINCIPAL_ID in the previous request will be used in the request below. The SCIM templateId is an Entra provided template. |
| 96 | + |
| 97 | +```curl title="Example request" |
| 98 | +curl -X POST 'https://graph.microsoft.com/v1.0/servicePrincipals/<SERVICE_PRINCIPAL_ID>/synchronization/jobs' \ |
| 99 | + --header 'Content-Type: application/json' \ |
| 100 | + --header 'Authorization: Bearer <accessToken>' \ |
| 101 | + --data-raw '{ |
| 102 | + "templateId": "scim" |
| 103 | +}' |
| 104 | +``` |
| 105 | + |
| 106 | +```curl title="Example response" |
| 107 | +{ |
| 108 | + "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals('a8cb133d-f841-4eb9-8bc9-c8e9e8c0d417')/synchronization/jobs/$entity", |
| 109 | + "id": "scim.5b223a2cc249463bbd9a791550f11c76.03d8207b-e837-4be9-b4e6-180492eb3b61", |
| 110 | + "templateId": "scim", |
| 111 | + "schedule": { |
| 112 | + "expiration": null, |
| 113 | + "interval": "PT40M", |
| 114 | + "state": "Disabled" |
| 115 | + }, |
| 116 | +// ... snipped rest of JSON payload |
| 117 | +``` |
| 118 | + |
| 119 | +**4. Configure the SCIM provisioning URL and API token** |
| 120 | + |
| 121 | +Next, configure the Tenant URL (Cloudflare SCIM endpoint) and API token (SCIM Provisioning API Token). |
| 122 | + |
| 123 | +Replace `<accessToken>`, `<ACCOUNT_ID>`, `<SCIM_PROVISIONING_API_TOKEN_VALUE>` with your values. |
| 124 | + |
| 125 | +```curl title="Example request" |
| 126 | + --header 'Content-Type: application/json' \ |
| 127 | + --header 'Authorization: Bearer <accessToken>' \ |
| 128 | + --data-raw '{ |
| 129 | + "value": [ |
| 130 | + { |
| 131 | + "key": "BaseAddress", |
| 132 | + "value": "https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/scim/v2" |
| 133 | + }, |
| 134 | + { |
| 135 | + "key": "SecretToken", |
| 136 | + "value": "<SCIM_PROVISIONING_API_TOKEN_VALUE>" |
| 137 | + } |
| 138 | + ] |
| 139 | +}' |
| 140 | +``` |
| 141 | + |
| 142 | +After completing the tasks above, the next steps in Entra include: |
| 143 | + |
| 144 | +- Additional group/provisioning configuration |
| 145 | +- Test and save after updating the config. |
| 146 | +- Provisioning after configuration is complete |
0 commit comments