Skip to content

Commit 3cc27c6

Browse files
committed
Merge branch 'main' into ReportMsg-chrisda
2 parents df5d1f9 + ddcd3e2 commit 3cc27c6

File tree

4 files changed

+697
-37
lines changed

4 files changed

+697
-37
lines changed

exchange/docs-conceptual/app-only-auth-powershell-v2.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,16 @@ After you register the certificate with your application, you can use the privat
291291

292292
### Step 5: Assign Azure AD roles to the application
293293

294+
You have two options:
295+
296+
- **Assign Azure AD roles to the application**: This method is supported in Exchange Online PowerShell and Security & Compliance PowerShell.
297+
- **Assign custom Exchange Online role groups to the application**: Currently, this method is supported only in Exchange Online PowerShell, and only when you connect in [REST API mode](exchange-online-powershell-v2.md#updates-for-version-300-the-exo-v3-module) (don't use the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command).
298+
299+
> [!NOTE]
300+
> You can also combine both methods to assign permissions. Like using Azure AD roles for the "Exchange Recipient Administrator" role and assign your custom RBAC role to extend the permissions.
301+
302+
#### Assign Azure AD roles to the application
303+
294304
The supported Azure AD roles are described in the following table:
295305

296306
|Role|Exchange Online<br>PowerShell|Security & Compliance<br>PowerShell|
@@ -357,3 +367,60 @@ For general instructions about assigning roles in Azure AD, see [View and assign
357367
- **Security & Compliance PowerShell**:
358368

359369
![The role assignments page after to added the app to the role for Security & Compliance PowerShell.](media/exo-app-only-auth-app-assigned-to-role-scc.png)
370+
371+
#### Assign custom Exchange Online role groups to the application
372+
373+
> [!NOTE]
374+
> Remember, this method is supported only in Exchange Online PowerShell, and only when you connect in [REST API mode](exchange-online-powershell-v2.md#updates-for-version-300-the-exo-v3-module) (don't use the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command).
375+
376+
For information about creating custom role groups, see [Create role groups](/exchange/permissions-exo/role-groups#create-role-groups). The custom role group that you assign to the application can contain any combination of built-in and custom roles.
377+
378+
To assign custom Exchange Online role groups to the application, do the following steps:
379+
380+
1. In [Azure Active Directory PowerShell for Graph](/powershell/azure/active-directory/install-adv2), run the following command to store the details of the Azure application that you registered in [Step 1](#step-1-register-the-application-in-azure-ad) in a variable:
381+
382+
```powershell
383+
$<VariableName1> = Get-AzureADServicePrincipal -SearchString "<AppName>"
384+
```
385+
386+
For example:
387+
388+
```powershell
389+
$AADApp = Get-AzureADServicePrincipal -SearchString "ExO PowerShell CBA"
390+
```
391+
392+
For detailed syntax and parameter information, see [Get-AzureADServicePrincipal](/powershell/module/azuread/get-azureadserviceprincipal).
393+
394+
2. In the same PowerShell window, connect to [Exchange Online PowerShell](connect-to-exchange-online-powershell.md) and run the following commands to:
395+
- Create an Exchange Online service principal object for the Azure application.
396+
- Store the details of the service principal in a variable.
397+
398+
```powershell
399+
New-ServicePrincipal -AppId $<VariableName1>.AppId -ServiceId $<VariableName1>.ObjectId -DisplayName "<Descriptive Name>"
400+
401+
$<VariableName2> = Get-ServicePrincipal -Identity "<Descriptive Name>"
402+
```
403+
404+
For example:
405+
406+
```powershell
407+
New-ServicePrincipal -AppId $AADApp.AppId -ServiceId $AADApp.ObjectId -DisplayName "SP for Azure App ExO PowerShell CBA"
408+
409+
$SP = Get-ServicePrincipal -Identity "SP for Azure App ExO PowerShell CBA"
410+
```
411+
412+
For detailed syntax and parameter information, see [New-ServicePrincipal](/powershell/module/exchange/new-serviceprincipal).
413+
414+
3. In Exchange Online PowerShell, run the following command to add the service principal as a member of the custom role group:
415+
416+
```powershell
417+
Add-RoleGroupMember -Identity "<CustomRoleGroupName>" -Member <$<VariableName2>.Identity | $<VariableName2>.ServiceId | $<VariableName2>.Id>
418+
```
419+
420+
For example:
421+
422+
```powershell
423+
Add-RoleGroupMember -Identity "Contoso View-Only Recipients" -Member $SP.Identity
424+
```
425+
426+
For detailed syntax and parameter information, see [Add-RoleGroupMember](/powershell/module/exchange/add-rolegroupmember).

exchange/exchange-ps/exchange/Connect-ExchangeOnline.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Connect-ExchangeOnline
3333
[[-Prefix] <String>]
3434
[[-CommandName] <String[]>]
3535
[[-FormatTypeName] <String[]>]
36+
[-AccessToken <String>]
3637
[-AppId <String>]
3738
[-BypassMailboxAnchoring]
3839
[-Certificate <X509Certificate2>]
@@ -280,6 +281,26 @@ Accept pipeline input: False
280281
Accept wildcard characters: False
281282
```
282283

284+
### -AccessToken
285+
**Note**: This parameter is available in version 3.1.0-Preview1 or later of the module.
286+
287+
The AccessToken parameter specifies the OAuth JSON Web Token (JWT) that's used to connect to ExchangeOnline.
288+
289+
Depending on the type of access token, you need to use this parameter with the Organization, DelegatedOrganization, or UserPrincipalName parameter.
290+
291+
```yaml
292+
Type: String
293+
Parameter Sets: (All)
294+
Aliases:
295+
Applicable: Exchange Online
296+
297+
Required: False
298+
Position: Named
299+
Default value: None
300+
Accept pipeline input: False
301+
Accept wildcard characters: False
302+
```
303+
283304
### -AppId
284305
The AppId parameter specifies the application ID of the service principal that's used in certificate based authentication (CBA). A valid value is the GUID of the application ID (service principal). For example, `36ee4c6c-0812-40a2-b820-b22ebd02bce3`.
285306

0 commit comments

Comments
 (0)