Configure admin-authorized mailbox access for Microsoft 365 (app-only Graph connection)#
8 min read
Supported platforms:
Microsoft 365
Configure admin-authorized mailbox access to allow Revenue Grid to connect to Microsoft 365 through Microsoft Graph without requiring users to authorize their mailboxes individually.
With application access, Revenue Grid uses an application identity to access Microsoft 365. Required application permissions are authorized through Microsoft Entra ID and, for Exchange mailbox permissions, Exchange Online RBAC for Applications.
Before you begin#
Understand how Revenue Grid uses Microsoft Graph#
Before configuring app-only access, see How Revenue Grid uses Microsoft Graph to connect to Microsoft 365 to learn:
Why Revenue Grid uses Microsoft Graph
The differences between delegated and app-only access
Which permissions Revenue Grid uses and how they are authorized
Known Microsoft Graph limitations
Once you’re familiar with the integration model, confirm the prerequisites below.
Prerequisites#
You have a Platform admin or Profile admin account in Revenue Grid.
The required user profiles have been created in Revenue Grid.
You have a Microsoft 365 admin account with permissions to grant tenant-wide consent.
The Exchange Online PowerShell module is installed.
Your administrator account is a member of the Organization Management role group in Exchange Online or is assigned the Exchange Administrator role in Microsoft Entra ID.
Configure app-only access#
To configure Microsoft Graph app-only access:
Step 1: Set the mailbox access type and grant Microsoft Entra ID permissions#
Sign in to the Revenue Grid platform.
In the upper-right corner, select your profile icon, and then select Settings.
Under the Administration section, go to Profiles.
Open the profile you want to configure and go to the Connectivity tab.
In the Email configuration section, in the Mailbox access type field, select Microsoft 365 OAuth (Graph API) - app-only access.
Click Connect account.
Sign in using your Microsoft 365 admin credentials.
Review and accept the permission request to grant Revenue Grid app-only access.
When the connection is successful, Email configuration displays Connected.
Step 2: Configure Exchange mailbox permissions#
Exchange Online RBAC for Applications grants Revenue Grid the required Exchange application permissions. You can grant these permissions organization-wide or scope them to specific mailboxes.
Get the Revenue Grid application IDs#
Get the identifiers of the Revenue Grid service principal in your Microsoft 365 tenant.
Open the Microsoft Entra admin center.
Go to Enterprise applications > All applications.
Find and open the Revenue Grid’s application.
On the Overview page, copy the Application ID and Object ID.
Important
Use the Application ID and Object ID from Enterprise applications, not App registrations. The Object IDs displayed in these areas are different. Exchange Online requires the service principal Object ID from Enterprise applications.
The examples in this article use the following example values:
Application ID: 336be6bf-83eb-47ad-93ef-123456789abc
Object ID: b70ff4ea-5243-4441-b286-abcdef123456
Replace these values with the IDs of the Revenue Grid enterprise application in your tenant.
Connect to Exchange Online#
Open PowerShell and connect to Exchange Online:
Connect-ExchangeOnline
For instructions, see Connect to Exchange Online PowerShell.
Register the Revenue Grid service principal in Exchange Online#
Create a pointer in Exchange Online to the Revenue Grid service principal in Microsoft Entra ID.
Run:
New-ServicePrincipal -AppId "<RevenueGridAppId>" -ObjectId "<ServicePrincipalObjectId>" -DisplayName "Revenue Grid"
Replace:
<RevenueGridAppId>with the Revenue Grid app’s Application ID.<ServicePrincipalObjectId>with the Revenue Grid app’s Object ID.
Example:
New-ServicePrincipal -AppId "336be6bf-83eb-47ad-93ef-123456789abc" -ObjectId "b70ff4ea-5243-4441-b286-abcdef123456" -DisplayName "Revenue Grid"
Choose the mailbox access scope#
You can grant Revenue Grid access to all Exchange Online mailboxes in your organization or limit access to specific mailboxes.
If Revenue Grid should access all mailboxes, you don’t need to create a resource scope. Skip to Assign the required Exchange application roles and omit the resource scope when assigning each role.
To limit access to specific mailboxes, configure a resource scope using one of the following methods.
Use a group to define the mailbox scope#
If you have a Microsoft 365 group, mail-enabled security group, or distribution list containing the mailboxes Revenue Grid should access, you can use its membership to define the management scope.
Get the distinguished name of the group:
Get-Group "<GroupEmailAddress>" | Format-List DistinguishedName
Example:
Get-Group "[email protected]" | Format-List DistinguishedName
Then create a management scope using the distinguished name returned by the previous command:
New-ManagementScope -Name "<ScopeName>" -RecipientRestrictionFilter "MemberOfGroup -eq '<DistinguishedName>'"
Important
Only direct group membership is included in the scope. Nested group members aren’t included.
Supported group types include only Microsoft 365 groups, mail-enabled security groups, and distribution lists.
Use a recipient property to define the mailbox scope#
You can also define a management scope based on a supported recipient property:
New-ManagementScope -Name "<ScopeName>" -RecipientRestrictionFilter "<RecipientProperty> -eq '<Value>'"
For example, to include mailboxes whose Department property is Sales:
New-ManagementScope -Name "Revenue Grid mailboxes" -RecipientRestrictionFilter "Department -eq 'Sales'"
You can use other supported recipient properties, such as custom attributes, depending on how your organization identifies the mailboxes Revenue Grid should access.
Use a Microsoft Entra administrative unit#
If your organization uses Microsoft Entra administrative units to organize users, you can use an administrative unit as the resource scope instead of creating an Exchange management scope.
In this case, you don’t need to run New-ManagementScope. Use the -RecipientAdministrativeUnitScope parameter when assigning the Exchange application roles, as described in the next section.
Assign the required Exchange application roles#
Assign the Exchange application roles required for the Revenue Grid functionality your organization uses. How you assign each role depends on the mailbox access scope you selected.
To determine which permissions must be granted through Exchange RBAC, see How Revenue Grid uses Microsoft Graph to connect to Microsoft 365 | Application permissions.
Important
If you limit Revenue Grid access to specific mailboxes, make sure that the Revenue Grid enterprise application doesn’t already have equivalent organization-wide mailbox permissions granted through Microsoft Entra ID. Organization-wide Microsoft Entra ID permissions remain effective independently of Exchange RBAC and aren’t restricted by the configured mailbox scope. For existing configurations, see Configure Exchange Online RBAC for Applications for an existing app-only connection.
For organization-wide access#
Don’t specify a resource scope:
New-ManagementRoleAssignment -App "<ServicePrincipalObjectId>" -Role "<ApplicationRole>"
For example, to grant Application Mail.ReadWrite organization-wide:
New-ManagementRoleAssignment -App "b70ff4ea-5243-4441-b286-abcdef123456" -Role "Application Mail.ReadWrite"
Repeat the command for each required Exchange application role.
For an Exchange management scope#
Specify the management scope using -CustomResourceScope:
New-ManagementRoleAssignment -App "<ServicePrincipalObjectId>" -Role "<ApplicationRole>" -CustomResourceScope "<ScopeName>"
For example, to grant Application Mail.ReadWrite to mailboxes in the Revenue Grid mailboxes scope:
New-ManagementRoleAssignment -App "b70ff4ea-5243-4441-b286-abcdef123456" -Role "Application Mail.ReadWrite" -CustomResourceScope "Revenue Grid mailboxes"
Repeat the command for each required Exchange application role, using the same mailbox scope.
For example, to also grant Application Calendars.ReadWrite:
New-ManagementRoleAssignment -App "b70ff4ea-5243-4441-b286-abcdef123456" -Role "Application Calendars.ReadWrite" -CustomResourceScope "Revenue Grid mailboxes"
For a Microsoft Entra administrative unit#
Specify the administrative unit using -RecipientAdministrativeUnitScope:
New-ManagementRoleAssignment -App "<ServicePrincipalObjectId>" -Role "<ApplicationRole>" -RecipientAdministrativeUnitScope "<AdministrativeUnitId>"
Replace <AdministrativeUnitId> with the ID of your Microsoft Entra administrative unit.
For example:
New-ManagementRoleAssignment -App "b70ff4ea-5243-4441-b286-abcdef123456" -Role "Application Mail.ReadWrite" -RecipientAdministrativeUnitScope "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
Verify the Exchange RBAC configuration#
Verify that the Revenue Grid service principal has the expected Exchange RBAC authorization.
Run:
Test-ServicePrincipalAuthorization -Identity "<ServicePrincipalObjectId>" -Resource "<MailboxEmailAddress>" | Format-Table
For example, suppose alex.wilson@contoso.com is included in the Revenue Grid mailboxes scope:
Test-ServicePrincipalAuthorization -Identity "b70ff4ea-5243-4441-b286-abcdef123456" -Resource "[email protected]" | Format-Table
The command returns the Exchange application role assignments for the service principal and indicates whether the specified mailbox is within the scope of each assignment.
For example:
RoleName GrantedPermissions AllowedResourceScope ScopeType InScope
-------- ------------------ -------------------- --------- -------
Application Mail.ReadWrite Mail.ReadWrite Revenue Grid mailboxes CustomRecipientScope True
Application Calendars.ReadWrite Calendars.ReadWrite Revenue Grid mailboxes CustomRecipientScope True
Verify that InScope is True for each role required to access the mailbox.
If you configured access to specific mailboxes, you can also run the command for a mailbox that shouldn’t be accessible. For the scoped roles, InScope should be False.
Important
Test-ServicePrincipalAuthorization verifies Exchange RBAC assignments only. It doesn’t include application permissions granted through Microsoft Entra ID.
Changes to Exchange RBAC authorization can take from 30 minutes to 2 hours to propagate. Test-ServicePrincipalAuthorization bypasses the permission cache, so test results are immediate. However, actual API access through Microsoft Graph may take longer to reflect changes.
Step 3: Provision test users and verify mailbox access#
Before completing production user provisioning, verify that Revenue Grid can access mailboxes through the configured application permissions.
Make sure that at least one test user is provisioned to Revenue Grid and assigned to the profile you configured. If necessary, see Provision users for instructions.
If you configured access to specific mailboxes, use at least two users for verification:
A user whose mailbox is included in the Exchange RBAC scope
A user whose mailbox isn’t included in the scope
Checking both mailboxes confirms that the RBAC scope is effective.
To check connectivity:
Sign in to the Revenue Grid Platform.
In the upper-right corner, select your profile icon, and then select Settings.
Under Administration, go to Profiles.
Open the profile that uses the app-only connection, and then go to the Connectivity tab.
In the Email configuration section, click Check users’ impersonated access.
Review the connection statuses for all users in the profile.
For a scoped configuration, the test user whose mailbox is included in the scope should be connected. The test user whose mailbox is outside the scope shouldn’t be connected.
If you recently changed an Exchange RBAC assignment and the result isn’t as expected, allow up to 2 hours for the permission cache to update, and then check access again.
Next steps#
After you verify mailbox access, continue with the standard user provisioning procedure to provision the remaining Revenue Grid users.