Integrations

Microsoft 365 Direct Email Injection Setup Guide

How to connect your Microsoft 365 account to PhishByte using Direct Email Injection, so simulated phishing emails are delivered straight into employee inboxes via the Microsoft Graph API.

15 min read • Integrations • Microsoft 365 • Email Delivery
Find out how vulnerable your team is to phishing. Get your free phishing risk score in 60 seconds.
Take the Free Assessment

Overview

PhishByte can integrate directly with Microsoft 365 through the Graph API. Using this API, PhishByte can inject simulated phishing and notification emails directly into employee inboxes using a technique known as Direct Email Injection (DMI). Because emails go straight into inboxes, they don't need to pass through your mail filters.

💡
Recommended for Microsoft 365. If your domain's email runs on Microsoft 365, PhishByte marks Direct Email Injection as Recommended when you add a new email provider.

Before You Begin

To complete this setup you will need to create a Microsoft Azure App Registration and obtain three pieces of information from it before configuring the integration in PhishByte.

Required Information
  1. Application (Client) ID: found on the App Registration overview page in Azure.
  2. Directory (Tenant) ID: found on the App Registration overview page in Azure.
  3. Client Secret Value: generated under Certificates & Secrets. Copy the value immediately after creation as it will not be shown again.
⚠️
Admin access required. You must have Global Administrator or Application Administrator rights in your Microsoft 365 / Microsoft Entra ID tenant to complete this setup. If you do not have these permissions, contact your IT administrator.
Step 1 of 2

Create an App Registration in Microsoft Azure

1.1: Log in to Azure
  1. Log in to the Microsoft Azure account linked to your Microsoft 365 Tenant: portal.azure.com
1.2: Navigate to App Registrations
  1. In the search bar at the top of the page, search for App registrations and click on the corresponding service.
Azure Portal — App Registrations search
1.3: Create a New Registration
  1. Click New Registration to create a new App Registration.
Azure Portal — New Registration button
1.4: Name and Register the App
  1. Provide the app with a unique and distinguishable name (e.g. PhishByte DMI Connector).
  2. Leave all other options on their default settings.
  3. Click the Register button.
Azure Portal — App Registration name and register
1.5: Copy the Application ID and Tenant ID
  1. While on the Overview page, copy the Application (Client) ID and Directory (Tenant) ID values to your clipboard or a text editor. You will need these later.
Azure Portal — Application ID and Tenant ID
1.6: Open API Permissions
  1. Click on the Manage → API permissions tab in the left sidebar.
Azure Portal — API Permissions tab
1.7: Add a Permission
  1. Click the Add a permission button.
Azure Portal — Add a permission button
1.8: Select Microsoft Graph
  1. Click the Microsoft Graph API option.
Azure Portal — Microsoft Graph API selection
1.9: Select Application Permissions
  1. Click Application permissions.
Azure Portal — Application permissions selection
1.10: Add Mail.ReadWrite Permission
  1. In the search box, type Mail.ReadWrite.
  2. Expand the Mail permission group.
  3. Select the Mail.ReadWrite permission.
Azure Portal — Mail.ReadWrite permission
1.11: Add User.Read.All Permission
  1. Change the search to User.Read.All.
  2. Expand the User permission group.
  3. Select the User.Read.All permission.
Azure Portal — User.Read.All permission
1.12: Add the Selected Permissions
  1. Click the Add permissions button at the bottom of the page to add the two permissions selected.
Azure Portal — Add permissions button
1.13: Confirm Permissions Appear
  1. Confirm that both Mail.ReadWrite and User.Read.All appear in the API Permissions table.
  2. A warning will appear next to each indicating that admin consent has not yet been granted. This is expected at this stage.
Azure Portal — Permissions listed without admin consent
1.14: Grant Admin Consent
  1. Click the Grant admin consent... button directly above the permissions table.
  2. After clicking, the Status column will update to indicate that access has been granted.
Azure Portal — Admin consent granted
1.15: Navigate to Certificates and Secrets
  1. Change to the Manage → Certificates & secrets tab in the left sidebar.
Azure Portal — Certificates and Secrets tab
1.16: Create a New Client Secret
  1. Click the New client secret button.
Azure Portal — New client secret button
1.17: Name and Set Expiry
  1. In the dialog that appears, provide the secret with a descriptive name (e.g. PhishByte DMI Connector Secret).
  2. Set an expiration date; the maximum of 730 days is recommended. Upon expiration you will need to provision a new secret.
  3. Click Add.
Azure Portal — Client secret name and expiry
1.18: Copy the Client Secret Value
  1. Your secret will now appear in the Client secrets table.
  2. Copy the Value of the newly created secret to your clipboard or text editor immediately. This value will not be shown again after you navigate away.
Azure Portal — Client secret value to copy
Step 2 of 2

Configure Direct Email Injection in PhishByte

2.1: Open Email Delivery Settings
  1. Log in to your PhishByte account.
  2. Navigate to Platform Settings → Email Delivery Settings. This opens the Manage Email Delivery Providers page.
2.2: Add Microsoft 365 as a New Email Provider
  1. Click the New Email Provider button.
  2. In the popup, select the Microsoft 365 option. If your domain's email runs on Microsoft 365, it will be marked Recommended.
2.3: Enter Your App Registration Details
  1. In the Set up Direct Email Injection for Microsoft 365 popup, give the integration a unique name (e.g. Microsoft 365). This is the name shown in your list of email delivery providers.
  2. Application (client) ID: paste the value copied in Step 1.5.
  3. Directory (tenant) ID: paste the value copied in Step 1.5.
  4. Client secret: paste the value copied in Step 1.18.
  5. Click Save.
PhishByte: Set up Direct Email Injection for Microsoft 365
2.4: Test the Integration
  1. The newly created integration will appear in the Mail Integrations table.
  2. Click the Test DMI Connectivity button to verify the integration is functioning correctly.
PhishByte — Test DMI Connectivity button
2.5: Run the Connectivity Test
  1. In the popup that appears, enter an email address you would like a test email sent to.
  2. Click the Test Connectivity button.
  3. This test confirms that PhishByte has sufficient privileges to insert emails into user inboxes and that the provided email address can be located within the linked Microsoft 365 account.
PhishByte — Test Connectivity email entry
2.6: Set as Default (Optional)
  1. If presented with a success notification, the integration is active.
  2. As an optional final step, you can set this integration as your default mail server. When set as default, it will be selected automatically whenever a new phishing campaign is created.
PhishByte — Set as default mail server
✅
All done. Your Microsoft 365 Direct Email Injection integration is now active. Simulated phishing emails will be delivered directly into employee inboxes, with no allow-listing needed for delivery.
⚠️
Using Safe Links or Safe Attachments? Microsoft Defender may still scan or rewrite links in simulated emails after they arrive. If simulation links lead to a "suspicious website" page, contact hookd@phishbyte.com.au and we'll help you set up the right exemptions.

Frequently Asked Questions

What happens if a user doesn't exist within the Microsoft 365 Tenant?
  1. If the user is sent a simulated phishing email, an error will appear next to their email address within the affected campaign making a note of the issue.
  2. If the user is sent a notification, a fallback to PhishByte email servers will occur to ensure the notification is still delivered.
Do I need to add PhishByte to any allow-lists?
  1. Not for delivery. Direct Email Injection places emails straight into inboxes, so no allow-listing or Advanced Delivery policy is needed for them to arrive.
  2. If your organisation uses Microsoft Defender Safe Links or Safe Attachments, links may still be scanned after delivery. Contact us if simulation links are being blocked.
My Client Secret has expired. What do I do?
  1. Go to your Azure App Registration → Certificates & Secrets → generate a new Client Secret.
  2. Copy the new secret value and update it in PhishByte under Email Delivery Settings for this integration.

Need help setting this up?

Our team is happy to walk you through the integration. Book a call and we'll get you set up.

PhishByte
Free Risk Assessment