Assign Custom Exchange Online Role Groups to the Application

    Follow the steps below to create custom Exchange Online role groups and assign custom Exchange Online role groups to an application:

    NOTE

    For more details on this method, refer to this Microsoft article.

    1. Refer to the instructions in Create role groups to create custom Exchange Online role groups. For more details on assigning roles to the Exchange Online role group, refer to the Cloud Governance Administrator Guide.

    2. In Microsoft Graph PowerShell, run the Get-MgServicePrincipal command to store the details of the application.

      Connect-MgGraph -Scopes 'Application.Read.All'
      
      $AADApp = Get-MgServicePrincipal -Filter "DisplayName eq '<AppName>'"

      Replace AppName with the application name, Cloud Governance for Exchange.

    3. In the same PowerShell window, connect to Exchange Online PowerShell and run the following commands:

      • Run the New-ServicePrincipal command to create an Exchange Online service principal object for the application.

      • Run the Get-ServicePrincipal command to store the details of the service principal in a variable.

      New-ServicePrincipal -AppId $AADApp.AppId -ObjectId $AADApp.Id -DisplayName "<Descriptive Name>"
      
      $SP = Get-ServicePrincipal -Identity "<Descriptive Name>"

      Replace Descriptive Name with the application name, Cloud Governance for Exchange.

    4. In Exchange Online PowerShell, run the following command to add the service principal as a member of the custom role group:

      Add-RoleGroupMember -Identity "<CustomRoleGroupName>" -Member $SP.Identity

      Replace CustomRoleGroupName with the name of your custom Exchange Online role group.