Skip to content

Commit cc71115

Browse files
authored
Merge pull request #11198 from MicrosoftDocs/MIfix-chrisda
MIfix-chrisda to Main
2 parents f7f0877 + e7d8584 commit cc71115

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

exchange/docs-conceptual/connect-exo-powershell-managed-identity.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use Azure managed identities to connect to Exchange Online PowerShell
33
ms.author: chrisda
44
author: chrisda
55
manager: dansimp
6-
ms.date: 8/21/2023
6+
ms.date: 8/24/2023
77
ms.audience: Admin
88
audience: Admin
99
ms.topic: article
@@ -303,7 +303,15 @@ The procedures in this step require the Microsoft Graph PowerShell SDK. For inst
303303
Connect-MgGraph -Scopes AppRoleAssignment.ReadWrite.All,Application.Read.All
304304
```
305305

306-
2. If a **Permissions requested** dialog opens, select **Consent on behalf of your organization**, and then select **Accept**.
306+
If a **Permissions requested** dialog opens, select **Consent on behalf of your organization**, and then click **Accept**.
307+
308+
2. Run the following command to verify that the Office 365 Exchange Online resource is available in Azure AD:
309+
310+
```powershell
311+
Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'"
312+
```
313+
314+
If the command returns no results, the next step won't work. See the subsection at the end of this section to fix the issue before you continue.
307315

308316
3. Run the following commands to grant the Exchange.ManageAsApp API permission for the managed identity to call Exchange Online:
309317

@@ -317,13 +325,37 @@ The procedures in this step require the Microsoft Graph PowerShell SDK. For inst
317325

318326
- `$MI_ID` is the Id (GUID) value of the managed identity that you stored in a variable in [Step 2](#step-2-store-the-system-assigned-managed-identity-in-a-variable).
319327
- `$AppRoleID` is the Id (GUID) value of the **Exchange.ManageAsApp** API permission that's the same in every organization.
320-
- `$ResourceID` is the Id (GUID) value of the **Office 365 Exchange Online** resource in Azure Active Directory. The Id value is different in every organization.
328+
- `$ResourceID` is the Id (GUID) value of the **Office 365 Exchange Online** resource in Azure AD. The AppId value is the same in every organization, but the Id value is different in every organization.
321329

322330
For detailed syntax and parameter information, see the following articles:
323331

324-
- [Connect-MgGraph](/powershell/module/microsoft.graph.applications/new-mgserviceprincipalapproleassignment).
332+
- [Connect-MgGraph](/powershell/module/microsoft.graph.applications/new-mgserviceprincipalapproleassignment)
333+
- [Get-MgServicePrincipal](/powershell/module/microsoft.graph.applications/get-mgserviceprincipal)
325334
- [New-MgServicePrincipalAppRoleAssignment](/powershell/module/microsoft.graph.applications/new-mgserviceprincipalapproleassignment)
326335

336+
#### What to do if the Office 365 Exchange Online resource is not available in Azure AD
337+
338+
If the following command returns no results:
339+
340+
```powershell
341+
Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'"
342+
```
343+
344+
Do the following steps:
345+
346+
1. Register an application in Azure AD as described in [Step 1: Register the application in Azure AD](app-only-auth-powershell-v2.md#step-1-register-the-application-in-azure-ad).
347+
2. Assign the Office 365 Exchange Online \> Exchange.ManageAsApp API permission to the application using the "Modify the app manifest" method as described in [Step 2: Assign API permissions to the application](app-only-auth-powershell-v2.md#step-2-assign-api-permissions-to-the-application).
348+
349+
After you do these steps, run the **Get-MgServicePrincipal** command again to confirm that the Office 365 Exchange Online resource is available in Azure AD.
350+
351+
For even more information, run the following command to verify that the Exchange.ManageAsApp API permission (`dc50a0fb-09a3-484d-be87-e023b12c6440`) is available in the Office 365 Exchange Online resource:
352+
353+
```powershell
354+
Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'" | Select-Object -ExpandProperty AppRoles | Format-Table Value,Id
355+
```
356+
357+
Now that the Office 365 Exchange Online resource is available, return to Step 4.3 in this section.
358+
327359
### Step 5: Assign Azure AD roles to the managed identity
328360

329361
The supported Azure AD roles are described in the following list:
@@ -374,9 +406,9 @@ To assign a role to the managed identity in Microsoft Graph PowerShell, do the f
374406
Connect-MgGraph -Scopes RoleManagement.ReadWrite.Directory
375407
```
376408

377-
2. If a **Permissions requested** dialog opens, select **Consent on behalf of your organization**, and then click **Accept**.
409+
If a **Permissions requested** dialog opens, select **Consent on behalf of your organization**, and then click **Accept**.
378410

379-
3. Use the following syntax to assign the required Azure AD role to the managed identity:
411+
2. Use the following syntax to assign the required Azure AD role to the managed identity:
380412

381413
```powershell
382414
$RoleID = (Get-MgRoleManagementDirectoryRoleDefinition -Filter "DisplayName eq '<Role Name>'").Id

0 commit comments

Comments
 (0)