A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Use the documented Exchange.ManageAsApp application permission and assign the service principal a supported Microsoft Entra role that grants Tenant Allow/Block List management—Security Administrator—instead of assigning the ordinary Tenant AllowBlockList Manager Exchange role with New-ManagementRoleAssignment -App.
The configuration described combines two different RBAC models:
-
Exchange.ManageAsAppauthorizes app-only Exchange Online PowerShell connectivity. - Exchange Application RBAC accepts special Application ... roles and documents Microsoft Graph and EWS as its supported protocols. Ordinary administrative roles such as
Tenant AllowBlockList Managerare not listed as Application RBAC roles.^1^ - Tenant Allow/Block List PowerShell management is documented for Organization Management, Security Administrator, or the Security Operator role group. The narrow
Tenant AllowBlockList Managerpermission works only when assigned directly through Exchange admin center → Roles → Admin Roles, which is a user/role-group assignment path—not an Application RBAC assignment.^2^
Configure the supported app-only path
- In Microsoft Entra admin center → App registrations → your app → API permissions, remove
Exchange.ManageAsAppV2if that is the literal permission currently assigned. - Add:
- Office 365 Exchange Online
- Application permissions
-
Exchange.ManageAsApp
- Grant tenant-wide admin consent. Microsoft’s app-only procedure requires that exact permission name, with type Application and status Granted for the organization.^3^
- Assign the app’s Enterprise application/service principal the Security Administrator Microsoft Entra role. This role grants add/remove access for Tenant Allow/Block List operations; the Exchange Administrator role used in your isolation test is not among the documented Tenant Allow/Block List roles.^2^
- Wait for authorization caches to refresh before retesting. Application-permission changes can take between 30 minutes and two hours depending on recent app activity.^1^
- Connect using the tenant’s primary
.onmicrosoft.comdomain:
Connect-ExchangeOnline `
-AppId $AppId `
-CertificateFilePath $PfxPath `
-CertificatePassword $PfxPassword `
-Organization "tenant.onmicrosoft.com" `
-ShowBanner:$false
The app-only documentation supports Connect-ExchangeOnline from module version 2.0.4 onward, so your tested 3.x versions satisfy that requirement.^3^
Then check command exposure before modifying data:
Get-Command Get-TenantAllowBlockListItems `
-ErrorAction Stop
Get-TenantAllowBlockListItems `
-ListType Sender
For the intended operation:
New-TenantAllowBlockListItems `
-ListType Sender `
-Block `
-Entries "[Email]" `
-NoExpiration
New-TenantAllowBlockListItems supports Sender entries and requires permissions before it is exposed or executable.^4^
Do not use this Application RBAC assignment for the target cmdlets
Remove or disregard this assignment for the connection test:
New-ManagementRoleAssignment `
-App <service-principal> `
-Role "Tenant AllowBlockList Manager"
For Application RBAC, Exchange requires an Exchange service-principal pointer and an Application role. Microsoft documents roles such as Application Mail.Read, Application Mail.Send, and Application EWS.AccessAsApp; it does not document Tenant AllowBlockList Manager as an application role.^1^
Test-ServicePrincipalAuthorization is useful only for actual Application RBAC grants; it deliberately tests access granted through that model and does not validate permissions granted separately through Microsoft Entra roles.^5^
If the corrected configuration still fails
At that point, the repeated cross-platform results make further certificate, network, or module-version rotation low value. Open a Microsoft 365 support case as a probable tenant-side EXO session-bootstrap issue and provide:
- UTC timestamp and correlation/request identifiers from module logs.
- Sanitized
Connect-ExchangeOnline -LogDirectoryPathoutput. - Module and PowerShell versions.
- Tenant primary domain, app ID, and service-principal object ID.
- Confirmation that the permission is exactly
Exchange.ManageAsApp, admin-consented. - Confirmation that Security Administrator is assigned to the Enterprise application.
- No token, PFX, certificate private key, or password.
The successful token acquisition establishes certificate authentication, but it does not establish that Exchange accepted the permission/role combination needed to construct the session’s command set.
References
- Role Based Access Control for Applications in Exchange Online
- Allow or block email using the Tenant Allow/Block List
- App-only authentication in Exchange Online PowerShell and Security & Compliance PowerShell | Microsoft Learn
- New-TenantAllowBlockListItems-Description
- Test-ServicePrincipalAuthorization-Syntax