# RBAC setup to use Graph Service in Service Suite

RBAC (Role-Based Access Control) for applications will eventually replace application access policies (see below). Today, the public preview shows some ragged edges in terms of the integration between Exchange Online and Azure AD that Microsoft says they’ll fix before general availability. Even with some bumps to navigate, the new functionality is a welcome addition that extends tenant control over their data, which is always a good thing.

In order to use this protocol you need to do the following configurations in your azure account so the roles and permissions are set correctly.

Once you have done the below steps you should be able to use the service suite Graph Service oauth2 client to send/receive emails using RBAC with the normal client commands.

1. Open Windows PowerShell as an Administrator
2. Execute: `<span class="editor-theme-code">connect-mggraph -scopes "Application.Read.All"</span>`. If the exception *"The term connect-mggraph' is not recognized as the name of a cmdlet"* appears, execute the command  
    `<span class="editor-theme-code">install-module microsoft.graph</span>`  
    ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/kHcTrBP8IqcwvbSw-206298f29d5e.png)
3. After Microsoft Graph is installed, execute again the command `<span class="editor-theme-code">connect-mggraph -scopes "Application.Read.All"</span>`
4. Sign in  
    ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/OElRg6l1XPwEIE4K-37ffdb10936f.png)
5. After signing in, should see this:  
    ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/Sd9vnWRdnhs1X26W-0637a63a1f99.png)
6. Execute: `<span class="editor-theme-code">$SP = Get-MgServicePrincipal -All</span>`
7. Execute: `<span class="editor-theme-code">$ServicePrincipalId = $SP | Where-Object {$_.displayName -eq "{Application name}"} | Select-Object -ExpandProperty Id</span>`
8. Execute: `<span class="editor-theme-code">$AppId = $SP | Where-Object {$_.displayName -eq "{Application name}"} | Select-Object -ExpandProperty AppId</span>`
9. Execute: `<span class="editor-theme-code">Write-Host ("AppId is {0} and Service Principal Id is {1}" -f $AppId, $ServicePrincipalId)</span>`  
    Output:  
    ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/ellJI1M5BPx28A5O-87cec8a9db4a.png)
10. Execute: `<span class="editor-theme-code">Install-Module -Name ExchangeOnlineManagement</span>`
11. Execute: `<span class="editor-theme-code">Import-module ExchangeOnlineManagement</span>`
12. Execute: `<span class="editor-theme-code">Connect-ExchangeOnline -UserPrincipalName {user email}</span>`  
    Output:  
    ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/lKXYKes4OuazsfFK-d60bf650e0a7.png)
13. Execute: `<span class="editor-theme-code">New-ServicePrincipal -AppId $AppId -ServiceId $ServicePrincipalId -DisplayName '{Application name}'</span>`
14. Execute: `<span class="editor-theme-code">New-ManagementScope -Name "Management emails" -RecipientRestrictionFilter "CustomAttribute1 -eq '{RolName}'"</span>`
15. Execute: `<span class="editor-theme-code">Set-Mailbox -Identity {username} -CustomAttribute1 "{RolName}"</span>`
16. Execute: `<span class="editor-theme-code">Get-EXOMailbox -Filter {CustomAttribute1 -eq "{RolName}"} | Format-Table DisplayName</span>`
17. Execute: `<span class="editor-theme-code">New-ManagementRoleAssignment -App $AppId -Role "Application Mail.Mail.ReadWrite" -CustomResourceScope "Management emails"</span>`
18. Execute: `<span class="editor-theme-code">New-ManagementRoleAssignment -App $AppId -Role "Application Mail.Send" -CustomResourceScope "Management emails"</span>`

# Assing a role to a user

Execute: Set-Mailbox -Identity {username} -CustomAttribute1 "{RolName}"

# List available permissions

Execute: `<span class="editor-theme-code">Get-ManagementRole | Where-Object {$_.Name -like "Application *"}</span>`

![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/Gh7WDj7krQbRxsj4-c92a9a08657e.png)

# See permissions assigned to a user

Execute: `<span class="editor-theme-code">Test-ServicePrincipalAuthorization -Identity $AppId -Resource {email}</span>`

![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/nRTNr662Vqg4NsNL-432430f42a9a.png)

---

## Validation checklist

After assigning the Graph application roles, verify the service principal and application identifiers returned by PowerShell, then confirm that the OAuth2 client used by Service Suite has the required permissions. Test with a non-production mailbox first and record the tenant, application, and role assignments used for troubleshooting.

Last updated: October 15, 2026

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>