Least-Privilege Email Notifications from Microsoft Fabric with Exchange Application RBAC
A production integration enabling Microsoft Fabric workloads to send automated
email through a dedicated Exchange Online shared mailbox without granting
tenant-wide Microsoft Graph Mail.Send access.
The problem
A data engineering workload needed to send automated operational notifications from Microsoft Fabric using a controlled corporate email address.
The straightforward solution appeared to be granting an Entra application
Microsoft Graph Mail.Send. But application-level Graph mail
permissions can create a much broader authorization boundary than a workload
actually requires.
The application only needed to send from one approved shared mailbox.
The environment introduced several real-world complications:
- Exchange was hybrid.
- Exchange recipients were still authoritative on-premises.
- Fabric required secure runtime access to application credentials.
- DEV and PROD needed independent workload identities.
- The original implementation guidance contained ambiguous API permissions.
Architecture
The final architecture deliberately separates the identity running the Fabric workload from the application identity Exchange authorizes to send email.
The key design decision: two identities, two jobs
The most important design choice was separating who runs the Fabric workload from which identity Exchange authorizes to send mail.
What I actually did
-
Reviewed the proposed third-party architecture and challenged a broad permission assumption.
I separated Microsoft Graph
Mail.Sendfrom Exchange OnlineApplication Mail.Sendand worked through the implementation requirements until it was confirmed that the additional Microsoft Graph application permissions were unnecessary for this deployment. -
Mapped the existing hybrid Exchange model before changing anything.
I queried existing
RemoteMailboxandRemoteSharedMailboxobjects, identified the established shared-mailbox AD location, and confirmed that new Exchange Online mailboxes should originate through the hybrid recipient-management path. -
Provisioned and validated the notification mailbox.
I created a
RemoteSharedMailbox, synchronized the object through Entra Connect, verified the resulting Exchange OnlineSharedMailbox, and reconciled the Exchange GUID between the cloud and on-premises objects. -
Built the application identity and Exchange authorization layer.
I created a dedicated Entra application/service principal, registered its
service-principal reference in Exchange Online, and built a resource scope
tied to the mailbox's
ExternalDirectoryObjectId. -
Implemented mailbox-specific Exchange authorization.
I assigned
Application Mail.Sendthrough the custom management scope instead of granting tenant-wide Microsoft GraphMail.Send. -
Proved the authorization boundary.
I tested the application against both the approved notification mailbox and
an unrelated mailbox. The approved mailbox returned
InScope = True; the unrelated mailbox returnedInScope = False. - Created a dedicated production secrets boundary. I provisioned a dedicated Azure Key Vault using Azure RBAC and stored the tenant ID, client ID, client secret, and sender address as independent secrets rather than distributing credentials through email or embedding them in code.
- Separated DEV and PROD workload identities. I reviewed the existing GitHub Actions / Fabric deployment architecture, documented the existing DEV OIDC trust, obtained approval for new production access, and introduced a dedicated PROD workload identity instead of extending the DEV service principal into Production.
Inspecting the hybrid Exchange model
The original implementation guidance assumed straightforward cloud mailbox creation. That was not appropriate for this environment because Exchange recipient attributes were still managed through the hybrid Exchange configuration.
I first enumerated existing remote shared mailboxes and inspected where the underlying directory objects were stored:
Get-RemoteMailbox -ResultSize Unlimited |
Where-Object {
$_.RecipientTypeDetails -eq "RemoteSharedMailbox"
} |
Select-Object DisplayName,
PrimarySmtpAddress,
SamAccountName,
DistinguishedName |
Format-Table -Auto
Creating a cloud-only shared mailbox would have introduced an object that did not follow the organization's established source-of-authority model. Mapping the existing recipients first allowed the new mailbox to follow the same lifecycle and synchronization process.
Provisioning the Hybrid Shared Mailbox
The notification mailbox was created as a remote shared mailbox so the on-premises directory remained authoritative for the synchronized recipient.
New-RemoteMailbox `
-Shared `
-Name "Fabric Notifications" `
-DisplayName "Fabric Notifications" `
-Alias "fabric-notifications" `
-SamAccountName "fabricnotify" `
-UserPrincipalName "fabric-notifications@example.com" `
-PrimarySmtpAddress "fabric-notifications@example.com" `
-RemoteRoutingAddress "fabric-notifications@tenant.mail.onmicrosoft.com" `
-OnPremisesOrganizationalUnit "OU=Shared_Mailboxes,OU=Resource_Accounts,DC=example,DC=local"
After synchronization, I validated the object from Exchange Online:
Get-Mailbox -Identity "fabric-notifications@example.com" |
Format-List DisplayName,
RecipientTypeDetails,
PrimarySmtpAddress,
ExternalDirectoryObjectId,
ExchangeGuid
The cloud mailbox was verified as a SharedMailbox, and its actual
Exchange GUID was then aligned with the on-premises
RemoteSharedMailbox representation.
Registering the notification application with Exchange
The Entra application and Exchange Online authorization are intentionally separate layers. After creating the Entra application, I registered the corresponding service principal reference in Exchange Online:
$AppId = "<application-client-id>"
$ServicePrincipalObjectId = "<service-principal-object-id>"
New-ServicePrincipal `
-AppId $AppId `
-ObjectId $ServicePrincipalObjectId `
-DisplayName "fabric-notifications"
The Exchange object acts as the reference used by Exchange Application RBAC.
Scoping access to exactly one mailbox
The authorization scope was constructed from the mailbox's
ExternalDirectoryObjectId rather than from the SMTP address.
$Sender = "fabric-notifications@example.com"
$Mailbox = Get-Mailbox -Identity $Sender
$MailboxObjectId =
[guid]$Mailbox.ExternalDirectoryObjectId
$Filter =
"ExternalDirectoryObjectId -eq '$MailboxObjectId'"
Get-Recipient `
-Filter $Filter `
-ResultSize Unlimited |
Format-Table PrimarySmtpAddress,
RecipientTypeDetails,
ExternalDirectoryObjectId
Only after confirming that the filter returned exactly one mailbox did I create the Exchange management scope:
New-ManagementScope `
-Name "fabric-notifications-scope" `
-RecipientRestrictionFilter $Filter
The scope follows the actual mailbox object. An SMTP-address change does not silently move authorization to another mailbox.
Assigning Application Mail.Send
The application received Exchange's
Application Mail.Send role through the custom resource scope.
New-ManagementRoleAssignment `
-Name "fabric-notifications-mailsend" `
-Role "Application Mail.Send" `
-App $ServicePrincipalObjectId `
-CustomResourceScope "fabric-notifications-scope"
Application Mail.Send is not the same as assigning
Microsoft Graph Mail.Send as an application permission. The latter
was intentionally not granted.
Proving the authorization boundary
I did not treat successful object creation as proof that least privilege was working. The final Exchange authorization was tested against both an intended and unintended resource.
Positive authorization test
Test-ServicePrincipalAuthorization `
-Identity $ServicePrincipalObjectId `
-Resource "fabric-notifications@example.com" |
Format-Table RoleName,
GrantedPermissions,
AllowedResourceScope,
InScope
RoleName GrantedPermissions AllowedResourceScope InScope
-------- ------------------ -------------------- -------
Application Mail.Send Mail.Send fabric-notifications-scope True
Negative authorization test
The same application was tested against an unrelated mailbox.
Test-ServicePrincipalAuthorization `
-Identity $ServicePrincipalObjectId `
-Resource "unrelated-user@example.com" |
Format-Table RoleName,
GrantedPermissions,
AllowedResourceScope,
InScope
RoleName GrantedPermissions AllowedResourceScope InScope
-------- ------------------ -------------------- -------
Application Mail.Send Mail.Send fabric-notifications-scope False
InScope = TrueUnrelated mailbox:
InScope = False
Protecting notification credentials with Azure Key Vault
Application credentials were intentionally kept out of tickets, email, source code, and Fabric notebooks.
I created a dedicated production Key Vault using Azure RBAC and stored only the configuration required by the notification workload:
graph-tenant-id
graph-client-id
graph-client-secret
graph-sender-address
The production Fabric workload identity receives
Key Vault Secrets User at the vault scope. Administrative
secret-management access remains a separate role.
DEV / PROD workload identity separation
The existing Fabric deployment model used GitHub Actions workload identity federation for DEV. Rather than extending the same service principal into Production, I recommended creating a separate PROD identity with independently governed access.
GitHub OIDC without stored Azure credentials
The Fabric deployment path uses GitHub Actions OIDC workload identity federation rather than storing a long-lived Entra client secret in GitHub.
GitHub Actions
|
| OIDC token
v
Microsoft Entra ID
|
| Federated Identity Credential
v
Environment-Specific Service Principal
|
v
Fabric Workspace
This gives the deployment pipeline a short-lived, environment-scoped identity while keeping the notification application's own credential isolated inside Azure Key Vault.
Security posture
Notable issues along the way
The initial cloud-focused implementation guidance did not account for the
existing hybrid Exchange model. I inspected existing recipients first and
determined that the notification mailbox needed to originate as a
RemoteSharedMailbox.
Microsoft Graph Mail.Send and Exchange
Application Mail.Send are different authorization mechanisms.
Separating those concepts prevented an unnecessarily broad Graph
application permission from being granted.
The early implementation guidance included directory-reading API permissions. Further technical review established that those permissions were required only when the deployment pipeline creates Fabric workspaces. This deployment uses existing workspaces, so the permissions were omitted.
Reusing the existing DEV deployment service principal would have crossed an environment boundary. I recommended and implemented a dedicated Production workload identity with independently governed access.