Mailbox-Scoped Access
Use this runbook to let ION read message bodies for phishing analysis in an
agreed subset of a customer’s mailboxes, and nowhere else. The phishing access
application azsp-ontinue-ion-access-phishing-write-prd-01
(ADR-0010)
receives Mail.Read tenant-wide at the Entra layer; the customer then restricts
it to the agreed mailboxes with Exchange Online RBAC for Applications. ION
does not process any mailbox until the customer has validated the scope.
The workflow view is in Mailbox access workflow.
Prerequisites
- An active customer onboarding record with the verified customer tenant (Customer onboarding).
- A signed data-processing or access agreement authorizing ION to read the named mailboxes.
- The customer uses Exchange Online.
- An agreed mailbox subset: a tagging convention (recommended) or an Administrative Unit.
- The phishing application is federated-only, with a FIC for each calling workload’s own UAMI (Workload identity federation).
- The customer Exchange admin has the
ExchangeOnlineManagementPowerShell module.
Scoping model
The Entra grant alone is not the effective boundary. The Exchange resource-scoped role assignment is. The credential type (federated) does not affect scoping; Exchange keys off the service principal.
Application permissions
The phishing application requests these Microsoft Graph application permissions:
| Permission | Purpose |
|---|---|
Mail.Read | Read reported message bodies, restricted by the Exchange scope |
Mail.ReadBasic.All | Read message metadata without bodies |
SecurityAnalyzedMessage.Read.All | Read Defender for Office 365 analyzed messages |
SecurityAnalyzedMessage.ReadWrite.All | Act on analyzed messages |
ThreatSubmission.Read.All | Read user and admin threat submissions |
ThreatSubmission.ReadWrite.All | Create and update threat submissions |
Exchange RBAC for Applications restricts the mailbox-content permission. Assign
only Application Mail.Read in Exchange.
Ontinue steps
Confirm the phishing application
Owner: Platform identity
Confirm the application is multi-tenant, requests exactly the permissions above, has no password or key credentials, and lists a FIC for each calling workload UAMI within the 20-credential limit.
Deliver the onboarding package
Owner: Customer onboarding owner
Deliver through the approved onboarding channel:
- the
organizationsadmin-consent URL with the onboarding record’sstate; - the application (client) ID, so the customer can find the enterprise application and its object ID after consent;
- the requested permissions and their justification;
- the agreed mailbox subset definition (tag value
MSSP-PhishingAnalysis, or the Administrative Unit name); and - this runbook’s customer steps and offboarding steps.
Customer steps
Consent to the application and grant permissions
Owner: Customer identity admin
A Privileged Role Administrator (or Global Administrator, activated just in time through PIM) opens the admin-consent URL:
https://login.microsoftonline.com/organizations/adminconsent?client_id={appClientId}&redirect_uri={registeredRedirect}&state={onboardingState}After consent, in Entra ID, Enterprise apps, open the application, review
Permissions, and record its Application ID and Object ID for the
Exchange steps. ION verifies that the returned tenant and state match the
onboarding record before continuing.
Connect to Exchange Online
Owner: Customer Exchange admin
Connect as a member of the Organization Management role group, or with the Application RBAC roles delegated through Exchange RBAC:
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -Organization <customer-tenant-domain>Create the Exchange service principal pointer
Owner: Customer Exchange admin
Use the application ID and the enterprise application’s object ID from step 3:
New-ServicePrincipal `
-AppId <appClientId> `
-ObjectId <enterpriseAppObjectId> `
-DisplayName "Ontinue ION Phishing Analysis"Tag the in-scope mailboxes
Owner: Customer Exchange admin
Set CustomAttribute1 on each agreed mailbox (also possible in the Exchange
admin center under Recipients, Mailboxes, Manage custom attributes):
Set-Mailbox -Identity analyst1@contoso.com -CustomAttribute1 "MSSP-PhishingAnalysis"
# repeat for each agreed mailboxConfirm the attribute is not already used for another purpose in the tenant.
Create the management scope
Owner: Customer Exchange admin
New-ManagementScope `
-Name "Ontinue ION Phishing Mailboxes" `
-RecipientRestrictionFilter "CustomAttribute1 -eq 'MSSP-PhishingAnalysis'"Assign Application Mail.Read at the scope
Owner: Customer Exchange admin
New-ManagementRoleAssignment `
-App <enterpriseAppObjectId> `
-Role "Application Mail.Read" `
-CustomResourceScope "Ontinue ION Phishing Mailboxes"Assign only Application Mail.Read. Do not assign
Application Mail.ReadWrite, Application Mail.Send, or any unscoped
assignment.
Validate the scope
Owner: Customer Exchange admin
# Expect InScope = True for an agreed mailbox
Test-ServicePrincipalAuthorization -Identity "Ontinue ION Phishing Analysis" -Resource analyst1@contoso.com | Format-Table
# Expect InScope = False for a mailbox outside the agreed set
Test-ServicePrincipalAuthorization -Identity "Ontinue ION Phishing Analysis" -Resource ceo@contoso.com | Format-TableProceed only when the in-scope mailbox returns True and the out-of-scope
mailbox returns False. Send the result to the onboarding owner.
Administrative Unit alternative
Where the customer prefers Entra Administrative Units (Entra ID P1 or P2), a Privileged Role Administrator creates the unit and adds the agreed mailbox users, then the Exchange admin scopes the assignment to it instead of steps 6 and 7:
Connect-MgGraph -TenantId <customerTenantId> -Scopes "AdministrativeUnit.ReadWrite.All"
$au = New-MgDirectoryAdministrativeUnit -DisplayName "Ontinue-ION-Phishing-Scope"
New-MgDirectoryAdministrativeUnitMemberByRef -AdministrativeUnitId $au.Id `
-OdataId "https://graph.microsoft.com/v1.0/users/<userObjectId>"
New-ManagementRoleAssignment `
-App <enterpriseAppObjectId> `
-Role "Application Mail.Read" `
-RecipientAdministrativeUnitScope <auObjectId>
Validate with Test-ServicePrincipalAuthorization exactly as in step 9.
Application Access Policies are deprecated and are not used for new onboarding.
ION end-to-end validation
Prove the boundary from ION
Owner: Service team
From the deployed workload, acquire an app-only Graph token for the customer tenant through its own UAMI and the phishing application, then:
GET https://graph.microsoft.com/v1.0/users/{scopedMailbox}/messages/{id}returns the message body; and- the same call against an out-of-scope mailbox returns
ErrorAccessDenied.
Only after both results are recorded does the onboarding owner enable phishing processing on the onboarding record.
Least-privilege customer roles
Grant these only to the people performing the steps, time-boxed through PIM where possible. Ontinue staff receive no standing customer-tenant admin roles.
| Task | Minimum Entra or Exchange role | Notes |
|---|---|---|
| Admin-consent the app and grant Graph application permissions | Privileged Role Administrator (or Global Administrator) | Prefer just-in-time activation; avoid standing Global Administrator |
| Create and manage an Administrative Unit | Privileged Role Administrator, plus an AU-scoped admin for membership | Only for the Administrative Unit alternative |
| Service principal pointer, management scope, role assignment, scope test | Organization Management role group, or delegated Application RBAC roles | In Entra, Exchange Administrator can assign these |
Tag mailboxes with CustomAttribute1 | Exchange Administrator (or Recipient Management) | Needed to set custom attributes |
Negative validation
Verify denial for each applicable case:
- an untagged mailbox returns
ErrorAccessDenied, andTest-ServicePrincipalAuthorizationreportsInScopeFalse; - a mailbox whose tag is removed becomes inaccessible after Exchange RBAC propagation;
Mail.ReadWriteorMail.Sendoperations fail;- ION does not process any mailbox while the onboarding record lacks validated scope evidence;
- a workload whose UAMI is not a FIC on the phishing application cannot obtain a token; and
- consent returned with a
tenantorstatethat does not match the onboarding record stops onboarding.
Offboarding and revocation
Disable phishing processing in ION
Owner: Customer onboarding owner
Disable mailbox processing on the onboarding record and stop affected jobs.
Remove the Exchange configuration
Owner: Customer Exchange admin
Get-ManagementRoleAssignment -Role "Application Mail.Read" |
Where-Object { $_.CustomResourceScope -eq "Ontinue ION Phishing Mailboxes" } |
Remove-ManagementRoleAssignment
Remove-ManagementScope -Identity "Ontinue ION Phishing Mailboxes"
Set-Mailbox -Identity analyst1@contoso.com -CustomAttribute1 $null # repeat per mailbox
Remove-ServicePrincipal -Identity "Ontinue ION Phishing Analysis"To narrow scope instead of offboarding, clear CustomAttribute1 on the
mailboxes leaving scope, or remove them from the Administrative Unit.
Delete the enterprise application
Owner: Customer identity admin
Delete the enterprise application in Entra. This removes the Graph grants and revokes the path for every ION workload.
Prove access is gone
Owner: Service team
Confirm a previously readable in-scope message now fails and close the onboarding record with the customer’s confirmation and the negative test result.
Ownership and evidence
Platform identity owns the phishing application and its FICs. The customer
identity admin owns consent; the customer Exchange admin owns the pointer,
tagging, scope, assignment, and scope test; customer security or risk approves
the access. The service team owns end-to-end validation. Retain the access
agreement, consent verification, Test-ServicePrincipalAuthorization output,
end-to-end in-scope and out-of-scope results, periodic recertification, and
offboarding evidence. Never retain message content or tokens as evidence.