The CanIPhish Microsoft Entra ID Integration enables you to synchronise your Entra ID groups and users to your CanIPhish account. When an employee is added to an Entra ID group, that employee will automatically be synchronised to the relevant CanIPhish employee list every 24 hours.
This guide covers both ways CanIPhish can sign in to your Microsoft app registration: a client secret or a federated credential.
Important Note: This guide should only be followed if you've set up white-labelling. If you haven't, please follow this setup guide instead. Always sign in through your white-labelled domain (for example phish.mybusiness.com), because CanIPhish decides which directory integration to show based on the domain in use. Only Platform Super Admins and Platform Admins can see the Directory Integration button.
Table of Contents
- Before You Start: Choose A Credential
- Step 1. Create An App Registration In Microsoft
- Step 2. Configure Directory Synchronisation In CanIPhish
- Switch An Existing Directory To A Federated Credential
- Frequently Asked Questions
- Appendix: Setup A Directory Synced Employee List
- Appendix: Additional Information on Microsoft API Scopes
Before You Start: Choose A Credential
CanIPhish reads your directory through a Microsoft app registration that you create in Step 1. It then needs a credential to sign in as that app, and you choose which one in the CanIPhish form:
- Federated credential (recommended where possible): You add a federated credential to the app registration that trusts CanIPhish for this one directory. There's no secret to create, share, store or rotate, and it works even if your organisation blocks new client secrets on app registrations. Microsoft calls this workload identity federation.
- Client secret: The option you may already be using. You create a client secret in Entra and paste it into CanIPhish. Client secrets expire, so before that happens you'll need to create a new one and update CanIPhish, or synchronisation stops.
Both options use the same app registration and the same permissions; only the credential differs. You can also switch an existing directory from a client secret to a federated credential later (see Switch An Existing Directory To A Federated Credential).
Client secret: follow Steps 1.1 to 1.18, then Steps 2.1 to 2.5 and 2.11.
Federated credential: the order matters, because the subject that Entra must trust is shown in the CanIPhish form. Work in this order:
- First, in Entra, create the app registration and grant its permissions (Steps 1.1 to 1.14). Skip the client secret steps.
- Next, in CanIPhish, in the workspace this directory is for, open the Directory integration form, choose Federated credential, enter the directory name and copy the Issuer and Subject (Steps 2.1 to 2.4 and 2.6).
- Then, in Entra, add the federated credential using those two values (Steps 2.7 to 2.9).
- Finally, back in CanIPhish, save the directory (Steps 2.10 and 2.11).
If Your Customer's Administrator Does The Microsoft Part
If you're setting this up for a customer and their administrator manages their Microsoft tenant, split the work like this.
With a federated credential (no secret changes hands):
- You: in CanIPhish, switch to your customer's workspace (the tenant selector at the top of the page), then open the Directory integration form (Steps 2.1 and 2.2), choose Federated credential, enter the Directory name and copy the Issuer and Subject (Step 2.6). You don't need the Application ID or Tenant ID yet.
- You: send the administrator the Issuer, the Subject and the Microsoft steps they need (Steps 1.1 to 1.14 and 2.7 to 2.9), either as a link to this guide or in your own words if you don't share this help centre with your customers. Neither value is a secret.
- The administrator: follows Steps 1.1 to 1.14 and 2.7 to 2.9, pasting the Issuer and Subject exactly as you sent them, then sends you the Application ID and Tenant ID from Step 1.5.
- You: in the same customer workspace, open the form again if you closed it, enter exactly the same Directory name, the Application ID and the Tenant ID, choose Federated credential, check the Subject matches the one you sent, and click Save directory (Steps 2.10 and 2.11).
With a client secret: the administrator follows Steps 1.1 to 1.18 and sends you the Application ID, Tenant ID and the secret's Value. Please use a secure channel for the secret. You then complete Step 2.
Step 1. Create An App Registration In Microsoft
Do this step in the Microsoft tenant whose employees you want to synchronise. To grant admin consent in Step 1.14 you'll need to be a Global Administrator or Privileged Role Administrator (Application Administrators and Cloud Application Administrators can't grant consent for Microsoft Graph application permissions).
1.1. Sign in to the Microsoft Azure portal linked to your Microsoft 365 tenant: https://portal.azure.com/. You can also use the Microsoft Entra admin center (https://entra.microsoft.com/), where app registrations are under Entra ID > App registrations. If your tenant is in Microsoft's US Government (GCC High) or China (21Vianet) cloud, sign in to that cloud's portal instead (see My Microsoft tenant is in GCC High, DoD or China (21Vianet)).
1.2. In the search bar at the top of the page, search for "App registrations" and click on the corresponding service.
1.3. Click "New registration" to create a new app registration:
1.4. Provide the app with a unique and distinguishable name (e.g. CanIPhish Entra ID Connector), leave the other options on their default setting (as shown below) and then click the Register button:
1.5. While on the Overview page, copy the Application (client) ID and Directory (tenant) ID values to your clipboard or a text editor, as you'll need them later. Use these two ID values, not the Object ID or a domain name such as contoso.onmicrosoft.com.
1.6. Click on the "Manage" > "API permissions" tab on the left:
1.7. Click the "Add a permission" button:
1.8. Click the "Microsoft Graph" API:
1.9. Click "Application permissions" (not "Delegated permissions"):
1.10. In the search box type in: "Directory.Read.All" and then expand the "Directory" permission, selecting the "Directory.Read.All" permission (Read directory data).
1.11. Now, change the search to look for: "User.Read.All" and then expand the "User" permission, selecting the "User.Read.All" permission (Read all users' full profiles).
1.12. Click "Add permissions" at the bottom of the page to add the two permissions you've selected:
1.13. Confirm that both permissions appear in the API permissions table, with the type "Application":
1.14. A warning appears next to each permission, showing that admin consent hasn't been granted yet. The permissions won't work until it is. Click the "Grant admin consent for..." button directly above the table and confirm. The Status column will then show that access has been granted.
Client Secret Only: Create A Client Secret
Using a federated credential? Skip Steps 1.15 to 1.18 and go straight to Step 2. You don't need a client secret.
1.15. Now change to the "Manage" > "Certificates & secrets" tab:
1.16. Click the "New client secret" button:
1.17. In the panel that appears on the right of your screen, give the secret a descriptive name (e.g. "CanIPhish Entra ID Connector Secret") and an expiry. We recommend the maximum of 730 days. When the secret expires you'll need to create a new one and update the directory in CanIPhish (see Do the credentials expire?). Then click "Add". If Entra doesn't let you add a client secret, your organisation may block them. Use a federated credential instead: you've already done everything it needs in Step 1, so go to Step 2 and choose Federated credential at Step 2.4.
1.18. Your secret will now appear in the Client secrets table. Copy its Value (not the Secret ID) to your clipboard or text editor. Entra only shows the value straight after you create it.
Step 2. Configure Directory Synchronisation In CanIPhish
2.1. Sign in to CanIPhish through your white-labelled domain and go to Phishing & Training > Employees in the menu. The page's address is your own domain followed by /platform/employees (for example https://phish.mybusiness.com/platform/employees).
2.2. Click the Directory Integration button at the top right of the page (it was previously called Directory Sync):
2.3. In the Directory integration dialog, check that Microsoft Entra ID is selected, then enter:
- Directory name: A unique and distinguishable name for this directory (e.g. "Entra-ID-Connector"). The letters A to Z (without accents) and the digits 0 to 9 are kept as you type them. Every other character, including spaces, accented letters and punctuation, becomes a hyphen, so "Entra ID Connector" is saved as "Entra-ID-Connector". Use a name that no other directory in your workspace uses, because saving under an existing directory's name replaces that directory. You can't rename a directory later.
- Application ID: Paste the Application (client) ID you copied in Step 1.5.
- Tenant ID: Paste the Directory (tenant) ID you copied in Step 1.5.
2.4. Under Credential, choose the option you picked. For Client secret (selected by default), continue at Step 2.5. For Federated credential, continue at Step 2.6.
If You Chose Client Secret
2.5. In the Client secret field, paste the secret Value you copied in Step 1.18, click Save directory and continue at Step 2.11:
If You Chose Federated Credential
Do these steps in order: copy the issuer and subject from CanIPhish first, add them in Entra, and only then save in CanIPhish. Don't type the subject yourself. Always copy it from the form.
2.6. The form now shows an Issuer and a Subject, each with a Copy button:
-
Issuer is always
https://id.caniverify.com, whichever domain you use CanIPhish on. -
Subject fills in as you type the Directory name. It starts with
workspace:followed by the ID of the CanIPhish workspace you're signed in to, and ends with:directory:followed by the name as CanIPhish will save it, for example:directory:Entra-ID-Connector. If it says "Enter a directory name first", type the Directory name above it.
The Subject belongs to one workspace. Copy it while you're in the workspace this directory is for, and save the directory in that same workspace. If you manage more than one workspace (for example, your customers' workspaces), switch to the right one before you open the form, and don't switch to another workspace in any CanIPhish browser tab until you've saved. A Subject copied in another workspace won't match. Each workspace needs its own federated credential, even if two directories have the same name.
Click Copy next to each one and keep both values to hand. "Copied to the clipboard." confirms each copy; if your browser doesn't allow copying, the value is selected for you, so press Ctrl+C (Cmd+C on a Mac). Keep this dialog open while you work in Entra. If you change the Directory name, copy the Subject again. If you close the dialog, enter exactly the same Directory name when you come back, so the Subject stays the same. If your customer's administrator does the Microsoft part, send them both values now (see If Your Customer's Administrator Does The Microsoft Part).
2.7. In a new browser tab, open the app registration: the one created in Step 1 or, for an existing directory, the one whose Application ID is shown in the CanIPhish form. In the Azure portal, search for "App registrations", select the All applications tab and search for the app's name or its Application (client) ID. Under Manage, select Certificates & secrets, then the Federated credentials tab, then + Add credential. To do this you need to own the app registration, or be an Application Administrator, Cloud Application Administrator or Global Administrator.
2.8. In the Add a credential panel, set Federated credential scenario to Other issuer.
2.9. Fill in the fields as follows, then click Add:
-
Issuer: Paste the Issuer shown in the CanIPhish form (or sent to you):
https://id.caniverify.com. Don't add a trailing slash or any spaces. - Type: Leave Explicit subject identifier selected. Don't choose Claims matching expression (Preview).
- Value: Paste the Subject shown in the CanIPhish form (or sent to you). Some Microsoft screens call this field Subject identifier. It must match exactly, including upper and lower case.
-
Name: A name you'll recognise, such as
CanIPhish-Entra-ID-Connector. Microsoft allows 3 to 120 letters, numbers, hyphens or underscores, starting with a letter or number, and you can't change the name later. - Description: Optional. For example, the directory's name in CanIPhish.
-
Audience: Check that it shows
api://AzureADTokenExchangeand leave it as it is. The only exceptions are tenants in Microsoft's US Government (GCC High) or China (21Vianet) clouds, which need their own value (see My Microsoft tenant is in GCC High, DoD or China (21Vianet)). If the Audience shows anything other than the value for your cloud, select Edit (optional) and enter the right one.
Entra accepts the credential even if a value is wrong. A mistake only shows up when CanIPhish checks the connection in the next step.
2.10. Go back to the CanIPhish Directory integration dialog. Check that Federated credential is still selected and that the Application ID and Tenant ID are filled in, then click Save directory. If you've only just added the credential, Entra can take a few minutes to recognise it. If CanIPhish says Entra didn't accept the federated credential, wait a few minutes and click Save directory again.
Both Options: Check The Connection
2.11. CanIPhish checks the connection to your directory before it saves anything, which can take up to 30 seconds. When the check passes, the page reloads with the message "The directory has been successfully saved." and the directory appears in the Connected directories table with the status Active. Its type is Entra ID for a client secret, or Entra ID (federated) for a federated credential. You're all done! Next, set up an employee list that syncs from this directory.
If the check fails, a message explains why and nothing is saved. Fix the details and click Save directory again. Saving the directory failed in the FAQ lists what to check for each message.
Switch An Existing Directory To A Federated Credential
You can move a directory that uses a client secret to a federated credential without recreating it. The directory keeps its name, Application ID and Tenant ID, so employee lists synced from it keep their groups and carry on synchronising.
1. On the Employees page, click Directory Integration.
2. In the Connected directories table, click the ⋮ button on the directory's row and choose Update directory. It can take 5 to 10 seconds to load.
3. In the Update directory dialog, under Credential, choose Federated credential. The Directory name can't be changed here, so the Subject is already filled in. The Application ID shown is the app registration you'll add the credential to.
4. Copy the Issuer and Subject, then add a federated credential to that same app registration in Entra, following Steps 2.7 to 2.9.
5. Back in CanIPhish, click Save directory. CanIPhish checks the federated credential before it changes anything, and the directory keeps using its client secret until the check passes. If the check fails, nothing changes (see Saving the directory failed).
6. Once it's saved, the directory's type shows Entra ID (federated) and CanIPhish no longer keeps the client secret. Delete the old client secret in Entra (the app registration's Certificates & secrets > Client secrets), unless something else still uses it.
To switch back to a client secret, create a new secret in Entra (Steps 1.15 to 1.18), then open Update directory, choose Client secret, paste its Value and click Save directory. CanIPhish doesn't remove the federated credential from Entra, so delete it there if you no longer need it.
Frequently Asked Questions
Which option should I choose?
Choose a federated credential wherever you can: there's no secret to manage or replace, and it works when your organisation blocks new client secrets. Choose a client secret if you prefer it, or if CanIPhish asks you to use one (see My Microsoft tenant is in GCC High, DoD or China (21Vianet)). Both read the same data with the same permissions. See Before You Start: Choose A Credential.
Do the credentials expire?
A client secret expires on the date you chose in Step 1.17. After that, synchronisation stops, and when a daily sync fails your workspace's admins receive an "Employee list sync failed" email. Before the secret expires, create a new one in Entra (Steps 1.15 to 1.18). Then on the Employees page click Directory Integration, open the directory's ⋮ menu, choose Update directory, paste the new Value into Client secret and click Save directory. Afterwards, delete the old secret in Entra. You can also switch the directory to a federated credential instead (see Switch An Existing Directory To A Federated Credential).
A federated credential has no expiry date and nothing to rotate. It keeps working until someone removes or changes it in Entra.
Can I switch an existing directory from a client secret to a federated credential?
Yes, without recreating the directory, and its employee lists keep their groups. Follow Switch An Existing Directory To A Federated Credential.
Can I rename a directory?
No. A directory's name can't be changed once it's saved, and a federated credential's Subject includes that name. To use a different name, add a new directory under the new name (Step 2). It gets a new Subject, so it needs its own federated credential in Entra: the existing credential won't match it. Employee lists synced from the old directory stay linked to it until you change them, so only delete the old directory, and its federated credential in Entra, once no employee list uses it. Don't save a new directory under an existing directory's name, as that replaces the existing directory.
Saving the directory failed. What should I check?
Nothing is saved when the check fails (a directory you're updating keeps its previous settings), so you can fix the details and click Save directory again. Look for these words in the message:
- "Please ensure a valid Application ID and Tenant ID are supplied" (or "...Application ID, Tenant ID, and Client Secret..."): enter the ID values from Step 1.5. They contain only letters, numbers and hyphens, with no spaces before or after, so a domain name such as contoso.onmicrosoft.com isn't accepted. Use the copy button next to each value on the app registration's Overview page. For a client secret, the Client secret field must also be filled in.
- "No app registration with that Application ID was found in that tenant": copy the Application (client) ID, not the Object ID, and check that the Tenant ID is for the same tenant.
- "That Tenant ID wasn't found": copy the Directory (tenant) ID from the app registration's Overview page.
- "Invalid Client Secret": paste the secret's Value, not its Secret ID.
- "The app registration signed in, but it can't read the directory": add the Directory.Read.All application permission and grant admin consent (Steps 1.6 to 1.14).
-
"Entra didn't accept the federated credential": check the federated credential's values. Its Issuer must be exactly
https://id.caniverify.com, its Type Explicit subject identifier, and its Value must match the Subject in the CanIPhish form exactly, including case (if you changed the Directory name, the Subject changed too). Check that you copied the Subject in the same workspace you're saving from, and that the Audience is the value for your cloud (Step 2.9). If you've just added or changed the credential, wait a few minutes and try again. - "The directory couldn't be read with these details": check the Application ID and Tenant ID. For a client secret, check you pasted its Value and that it hasn't expired. For a federated credential, check that the app registration whose Application ID you entered has the federated credential (Steps 2.7 to 2.9); if you added it in the last few minutes, wait a few minutes and try again. Also check that your organisation's Entra policies don't block federated credentials. Finally, check that Directory.Read.All has admin consent.
- "The connection couldn't be checked" or "Federated sign-in is unavailable right now": try again shortly.
- Just "Error": refresh the page, sign in again if asked, and enter the details again. With the same Directory name, in the same workspace, the Subject is unchanged. If it keeps happening, please contact our support team.
- Any message that asks you to contact support: please contact our support team.
Groups won't load when I set up an employee list. What should I check?
If choosing the directory shows "There are insufficient permissions to collect directory groups", the cause isn't always a permission. First check that the client secret hasn't expired (see Do the credentials expire?), or that the federated credential is still on the app registration with the same values (Steps 2.7 to 2.9). Then check that Directory.Read.All has admin consent (Steps 1.6 to 1.14). Any other message means the same as it does when you save a directory (see Saving the directory failed).
My Microsoft tenant is in GCC High, DoD or China (21Vianet). What changes?
Microsoft 365 GCC (also called GCC Moderate) tenants use Microsoft's worldwide cloud, so follow this guide as written and keep the default Audience, api://AzureADTokenExchange.
-
GCC High: in Steps 1.1 and 2.7, sign in at https://portal.azure.us/ instead of portal.azure.com. For a federated credential, set the Audience to
api://AzureADTokenExchangeUSGov. -
China (operated by 21Vianet): sign in at https://portal.azure.cn/ instead. For a federated credential, set the Audience to
api://AzureADTokenExchangeChina. If CanIPhish says the federated credential couldn't be verified for an Azure China (21Vianet) tenant, use a client secret for that directory instead. - DoD: please contact our support team before you set this up.
What happens in Entra when I delete a directory in CanIPhish?
Nothing. Deleting a directory (its ⋮ menu, then Delete directory) only removes it from CanIPhish. If you no longer need them, delete the federated credential or client secret, or the whole app registration, in Entra yourself.
Appendix: Setup A Directory Synced Employee List
1. To set up a directory synced employee list, go to the Employees page on your white-labelled domain and click the New Employee List button.
2. Enter an Employee list name.
3. Under List type, choose Directory import.
4. Under Directory, choose the directory you'd like to sync. It may take up to 30 seconds for its groups to load. If they don't load, see Groups won't load when I set up an employee list.
5. Under Groups to sync, choose one or more groups for CanIPhish to sync.
6. Click Sync directory employees.
7. Click Save employee list.
Appendix: Additional Information on Microsoft API Scopes
We'll be accessing APIs that allow us to read information relating to directory groups, group members and individual employees. Both permissions below are Microsoft Graph application permissions that need admin consent, and they're the same whether you use a client secret or a federated credential:
Directory.Read.All (Read directory data)
Provides CanIPhish with access to read directory data such as groups, group members (including members of nested groups), employees and employee information, including each employee's manager. Groups with hidden membership don't return their members with this permission, so a list that syncs one may get no employees from it. Choose a different group, or contact our support team.
User.Read.All (Read all users' full profiles)
Provides CanIPhish with access to read user profile information so we can gather data such as first names, last names, job titles, and company names, which are all used to support phishing and training campaigns.
Please grant both permissions, using Directory.Read.All rather than a narrower group permission. When you save a directory, CanIPhish only checks that the app can sign in and list groups, so a missing permission can let the directory save and then make employee syncs fail.
Comments
0 comments
Please sign in to leave a comment.