CanIPhish can integrate directly with Microsoft 365 through the Graph API. Using this API we can inject simulated phishing and notification emails directly into employee inboxes, bypassing the need for traditional email allowlisting.
The same setup can also connect directory sync, so your employee lists stay in step with your Microsoft Entra ID groups, and it makes email quarantine available in Phish Triage. Microsoft asks for consent once, for everything you choose.
Note: If you're managing CanIPhish from within a white-label, please follow this setup guide. Additionally, if you're using On-Prem Exchange in a hybrid setup with M365, DMI may not function, as Microsoft's Graph API cannot inject emails into inboxes hosted by an On-Prem Exchange server. Instead, use our standard M365 allowlisting guidance.
Before you start: you'll sign in to Microsoft as a Global Administrator or Privileged Role Administrator of your Microsoft 365 tenant. Do the whole setup yourself, in one browser: the person who clicks Sign in with Microsoft in CanIPhish has to be the one who accepts at Microsoft.
Direct Email Injection Setup Steps
To set up direct email injection, follow the steps below:
- Login to your account and navigate Platform Settings > Email Delivery Settings
- Click New Email Provider, then select Microsoft 365.
-
In the Set up Microsoft 365 dialog:
- Name the integration: enter a unique name. It's shown in your list of email delivery providers, and a directory added by this setup gets the same name.
- Choose what to connect: Direct email injection is always on. Leave Directory sync on (recommended) to also sync your Entra ID groups and make email quarantine available, or turn it off to connect direct email injection only. Hover over each ⓘ icon to see what Microsoft will ask for.
- Click Sign in with Microsoft.
-
If Microsoft asks you to sign in, use your Global Administrator or Privileged Role Administrator account. Microsoft then shows Permissions requested for the CanIPhish Connector app, marked Review for your organization. It lists the permissions for everything you chose, and accepting grants them for your whole organization. Click Accept.
Note: Access to all the listed permissions is required. With Directory sync switched off, the screen names the CanIPhish Email Connector app and lists fewer permissions. See the appendix for what each one is used for. If more than one Microsoft account is signed in to your browser, Microsoft may also ask which account to continue with: pick the same administrator account.
-
You're returned to the Email Delivery Providers page, where Microsoft 365 is connected shows what was set up:
- Direct email injection is Connected. If CanIPhish's own mail servers were still your default delivery provider, the new integration becomes your default, and the dialog says so. If you'd already chosen another default, that stays.
- Directory sync is Connected: a Microsoft Entra ID directory with the same name as the integration was added. Click Create an employee list to create a list that syncs from the groups you choose (see Microsoft Entra ID Employee Directory Synchronisation). If this Microsoft 365 tenant was already synced, it shows Already connected and your existing directory and employee lists are left as they are.
- Email quarantine is Available. When you're ready to turn it on, click Configure Phish Triage and follow Microsoft 365 - Email Quarantine.
Note: If you turned Directory sync off, you'll see the message Microsoft 365 is connected. instead. If it's your first delivery provider, the page then asks Make this your default?
- Optional: to make the integration your default delivery provider yourself, open the actions menu (⋮) on its row and choose Set as default. The default is selected whenever a new campaign is created and is used when notifications are sent. Existing campaigns keep the mail server they were created with; see Troubleshooting: Direct Email Injection.
All done! Before you launch a campaign, test the integration as described below.
Test The Integration
This integration doesn't have a Test connectivity or Validate Connection button. Test it by sending yourself a test email through it:
- Go to Phishing & Training > Campaigns, click New Campaign and choose Simulated Phishing Campaign.
- On the Name & audience step, enter a name and select an employee list. Expand Advanced settings, set Sending mail server to your new integration, and click Continue.
- On the Phishing content step, click Configure on an email.
- Under Send yourself a test, enter your email address and click Send.
- Check that the email arrives in your Inbox, then close the wizard. Closing it before you launch discards the campaign.
You can also open an email under Phishing & Training > Phishing Content > Phishing Emails and click Send test email. That test goes through your default delivery provider, so set this integration as the default first (Step 11).
Note: The test address must be on a verified domain and must be a mailbox in the Microsoft 365 tenant you connected. The confirmation message only means the test was processed, so always check that the email arrived. If it didn't, see Troubleshooting: Direct Email Injection.
Appendix: Additional Information on Microsoft API Scopes
We'll be accessing APIs that allow us to read and write information to employee inboxes and, with directory sync, to read your directory's groups. The table below lists every permission Microsoft asks for, under the names Microsoft shows on the Permissions requested screen. With Directory sync switched on, Microsoft asks on behalf of the CanIPhish Connector app. With it off, it asks on behalf of the CanIPhish Email Connector app, which requests only the permissions marked Always.
| Permission | What it's for | Requested |
|---|---|---|
|
Mail.ReadWrite Read and write mail in all mailboxes |
Finds each employee's Inbox and puts simulated phishing and notification emails there. Email quarantine also uses it to move reported emails. | Always |
|
User.Read.All Read all users' full profiles |
Finds the mailbox that matches each employee's email address. | Always |
|
Directory.Read.All Read directory data |
Reads your Entra ID groups and their members for directory sync. | With directory sync |
|
ThreatSubmission.ReadWrite.All Read and write all of the organization's threat submissions |
Used only by email quarantine, to report confirmed phishing and spam to Microsoft, if you turn quarantine on in Phish Triage. | With directory sync |
|
openid, User.Read Sign in and read user profile |
Confirms who signed in, and that they're a Global Administrator or Privileged Role Administrator of the tenant that gave consent. | Always |
|
offline_access Maintain access to data you have given it access to |
Keeps the connection working without anyone signing in again. | Always |
Frequently Asked Questions
Who can connect Microsoft 365?
A Global Administrator or Privileged Role Administrator of the Microsoft 365 tenant, who is also an administrator in your CanIPhish workspace. They need to start the setup in CanIPhish and accept at Microsoft themselves, in the same browser, within 30 minutes: forwarding the Microsoft link to someone else doesn't work. If your Microsoft administrator isn't a CanIPhish user yet, invite them to your workspace first.
Can I add directory sync later?
Yes. Set up Microsoft 365 again with the same integration name and Directory sync switched on. The existing integration is updated in place, and campaigns that use it keep working. You can also connect a directory from Employees > Directory Integration; see Microsoft Entra ID Employee Directory Synchronisation.
What happens if a user doesn't exist within the Microsoft 365 Tenant?
If the user is sent a simulated phishing email, the campaign shows Failure - Employee Not Found In Microsoft 365 next to their email address. If the user is sent a notification, then a fallback to use CanIPhish email servers will occur to ensure the notification is still sent.
Do existing campaigns switch to Direct Email Injection when I make it my default?
No. Each campaign keeps the mail server it was created with. The default is only selected automatically when you create a new campaign, and is used for notifications. To check or change a campaign's mail server, see Troubleshooting: Direct Email Injection.
Comments
0 comments
Please sign in to leave a comment.