You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exchange/docs-conceptual/app-only-auth-powershell-v2.md
+33-15Lines changed: 33 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: App-only authentication in Exchange Online PowerShell and Security & Comp
3
3
ms.author: chrisda
4
4
author: chrisda
5
5
manager: dansimp
6
-
ms.date: 01/31/2023
6
+
ms.date: 5/3/2023
7
7
ms.audience: Admin
8
8
audience: Admin
9
9
ms.topic: article
@@ -44,10 +44,6 @@ Certificate based authentication (CBA) or app-only authentication as described i
44
44
>
45
45
> You can use Microsoft Graph to replace most of the functionality from those cmdlets. For more information, see [Working with groups in Microsoft Graph](/graph/api/resources/groups-overview).
46
46
>
47
-
> - In Security & Compliance PowerShell, you can't use the procedures in this article with the following cmdlets:
> - Delegated scenarios are supported in Exchange Online. The recommended method for connecting with delegation is using GDAP and App Consent. For more information, see [Use the Exchange Online PowerShell v3 Module with GDAP and App Consent](/powershell/partnercenter/exchange-online-gdap-app). You can also use multi-tenant applications when CSP relationships are not created with the customer. The required steps for using multi-tenant applications are called out within the regular instructions in this article.
52
48
>
53
49
> - If the procedures in this article don't work for you, verify that you don't have Beta versions of the PackageManagement or PowerShellGet modules installed by running the following command: `Get-InstalledModule PackageManagement -AllVersions; Get-InstalledModule PowerShellGet -AllVersions`.
@@ -65,7 +61,7 @@ The following examples show how to use the Exchange Online PowerShell module wit
65
61
>
66
62
> The following connection commands have many of the same options available as described in [Connect to Exchange Online PowerShell](connect-to-exchange-online-powershell.md) and [Connect to Security & Compliance PowerShell](connect-to-scc-powershell.md). For example:
67
63
>
68
-
> -In Exchange Online PowerShell using the EXO V3 module, you can omit or include the _UseRPSSession_ switch to use REST API cmdlets or original remote PowerShell cmdlets. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
64
+
> -You can use REST API cmdlets or original remote PowerShell cmdlets. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
69
65
>
70
66
> Remote PowerShell support in Exchange Online PowerShell will be deprecated. For more information, see [Announcing Deprecation of Remote PowerShell (RPS) Protocol in Exchange Online PowerShell](https://aka.ms/RPSDeprecation).
71
67
>
@@ -75,10 +71,13 @@ The following examples show how to use the Exchange Online PowerShell module wit
75
71
> -**Connect-ExchangeOnline in DoD**: `-ExchangeEnvironmentName O365USGovDoD`.
76
72
> -**Connect-IPPSSession in DoD**: `-ConnectionUri https://l5.ps.compliance.protection.office365.us/powershell-liveid/ -AzureADAuthorizationEndpointUri https://login.microsoftonline.us/common`.
77
73
>
78
-
> - If a **Connect-IPPSSession** command present a login prompt, run the command: `$Global:IsWindows = $true` before the **Connect-IPPSSession** command.
74
+
> - If a **Connect-IPPSSession** command presents a login prompt, run the command: `$Global:IsWindows = $true` before the **Connect-IPPSSession** command.
79
75
80
76
-**Connect using a certificate thumbprint**:
81
77
78
+
> [!NOTE]
79
+
> The CertificateThumbprint parameter is supported only in Microsoft Windows.
80
+
82
81
The certificate needs to be installed on the computer where you're running the command. The certificate should be installed in the user certificate store.
83
82
84
83
- <u>Exchange Online PowerShell</u>:
@@ -166,7 +165,7 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
166
165
167
166

168
167
169
-
Or, to go directly to the **App registrations** page, use <https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/RegisteredApps>.
168
+
Or, to go directly to the **App registrations** page, use <https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade>.
170
169
171
170
3. On the **App registrations** page, click **New registration**.
172
171
@@ -219,6 +218,23 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
219
218
],
220
219
```
221
220
221
+
> [!NOTE]
222
+
> Microsoft 365 GCC High or DoD environments have access to Security & Compliance PowerShell only. Use the following values for `resourceAppId`, `resourceAccess id`, and `resourceAccess type`:
3. Still on the **Manifest** page, under **Management**, select **API permissions**.
@@ -314,7 +330,7 @@ For more information about the URL syntax, see [Request the permissions from a d
314
330
You have two options:
315
331
316
332
-**Assign Azure AD roles to the application**: This method is supported in Exchange Online PowerShell and Security & Compliance PowerShell.
317
-
-**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-the-exo-v3-module) (don't use the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command).
333
+
-**Assign custom Exchange Online role groups to the application using service principals**: This method is supported only when you connect in [REST API mode](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
318
334
319
335
> [!NOTE]
320
336
> You can also combine both methods to assign permissions. For example, you can use Azure AD roles for the "Exchange Recipient Administrator" role and also assign your custom RBAC role to extend the permissions.
@@ -390,14 +406,16 @@ For general instructions about assigning roles in Azure AD, see [View and assign
390
406
391
407

392
408
393
-
#### Assign custom Exchange Online role groups to the application
409
+
#### Assign custom Exchange Online role groups to the application using service principals
394
410
395
411
> [!NOTE]
396
-
> 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-the-exo-v3-module) (don't use the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command).
412
+
> You need to connect to Exchange Online PowerShell or Security & Compliance PowerShell _before_ completing steps to create a new service principal. Creating a new service principal without connecting to PowerShell won't work (your Azure App ID and Object ID is needed to create the new service principal).
413
+
>
414
+
> This method is supported only when you connect in [REST API mode](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
397
415
398
416
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.
399
417
400
-
To assign custom Exchange Online role groups to the application, do the following steps:
418
+
To assign custom role groups to the application using service principals, do the following steps:
401
419
402
420
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:
403
421
@@ -413,8 +431,8 @@ To assign custom Exchange Online role groups to the application, do the followin
413
431
414
432
For detailed syntax and parameter information, see [Get-AzureADServicePrincipal](/powershell/module/azuread/get-azureadserviceprincipal).
415
433
416
-
2. In the same PowerShell window, connect to [Exchange Online PowerShell](connect-to-exchange-online-powershell.md) and run the following commands to:
417
-
- Create an Exchange Online service principal object for the Azure application.
434
+
2. In the same PowerShell window, connect to [Exchange Online PowerShell](connect-to-exchange-online-powershell.md)or [Security & Compliance PowerShell](connect-to-scc-powershell.md)and run the following commands to:
435
+
- Create a service principal object for the Azure application.
418
436
- Store the details of the service principal in a variable.
419
437
420
438
```powershell
@@ -433,7 +451,7 @@ To assign custom Exchange Online role groups to the application, do the followin
433
451
434
452
For detailed syntax and parameter information, see [New-ServicePrincipal](/powershell/module/exchange/new-serviceprincipal).
435
453
436
-
3. In Exchange Online PowerShell, run the following command to add the service principal as a member of the custom role group:
454
+
3. In Exchange Online PowerShell or Security & Compliance PowerShell, run the following command to add the service principal as a member of the custom role group:
Copy file name to clipboardExpand all lines: exchange/docs-conceptual/connect-exo-powershell-managed-identity.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Use Azure managed identities to connect to Exchange Online PowerShell
3
3
ms.author: chrisda
4
4
author: chrisda
5
5
manager: dansimp
6
-
ms.date:
6
+
ms.date:5/10/2023
7
7
ms.audience: Admin
8
8
audience: Admin
9
9
ms.topic: article
@@ -242,6 +242,9 @@ For detailed syntax and parameter information, see [Get-AzADServicePrincipal](/p
242
242
243
243
#### Add the Exchange Online PowerShell module to Azure Automation accounts with system-assigned managed identities
244
244
245
+
> [!TIP]
246
+
> If the following procedure in the Azure portal doesn't work for you, try the **New-AzAutomationModule** command in Azure PowerShell that's described after the Azure portal procedure.
247
+
245
248
1. On the **Automation accounts** page at <https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.Automation%2FAutomationAccounts>, select the Automation account.
246
249
2. In the details flyout that opens, start typing "Modules" in the **Search** box, and then select **Modules** from results.
247
250
3. On the **Modules** flyout that opens, click **Add a module**.
@@ -261,17 +264,18 @@ For detailed syntax and parameter information, see [Get-AzADServicePrincipal](/p
261
264
To add the module to the Automation account in Azure PowerShell, use the following syntax:
-\<ResourceGroupName\> is the name of the resource group that's already assigned to the Automation account.
268
271
-\<AutomationAccountName\> is the name of the Automation account.
272
+
-\<LatestModuleVersion\> is the current version of the ExchangeOnlineManagement module. To see the latest GA (non-Preview) version of the module, run the following command in Windows PowerShell: `Find-Module ExchangeOnlineManagement`. To see the latest Preview release, run the following command: `Find-Module ExchangeOnlineManagement -AllowPrerelease`.
269
273
- Currently, the PowerShell procedures don't give you a choice for the runtime version (it's 5.1).
Copy file name to clipboardExpand all lines: exchange/docs-conceptual/connect-to-exchange-online-powershell.md
+18-5Lines changed: 18 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ To connect to Exchange Online PowerShell from C#, see [Use C# to connect to Exch
34
34
- The requirements for installing and using the module are described in [Install and maintain the Exchange Online PowerShell module](exchange-online-powershell-v2.md#install-and-maintain-the-exchange-online-powershell-module).
35
35
36
36
> [!NOTE]
37
-
> If you're using the EXO V3 module (v3.0.0 or later) and you don't use the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command, you'll have access to REST API cmdlets _only_. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
37
+
> If you're using the EXO V3 module (v3.0.0 or later) and you don't use the _UseRPSSession_ switch in the **Connect-ExchangeOnline** command, you have access to REST API cmdlets _only_. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
38
38
>
39
39
> Remote PowerShell support in Exchange Online PowerShell will be deprecated. For more information, see [Announcing Deprecation of Remote PowerShell (RPS) Protocol in Exchange Online PowerShell](https://aka.ms/RPSDeprecation).
For detailed syntax and parameter information, see [Connect-ExchangeOnline](/powershell/module/exchange/connect-exchangeonline).
71
71
72
-
**Notes**:
73
-
74
72
-_\<UPN\>_ is your account in user principal name format (for example, `[email protected]`).
75
73
76
74
- With the EXO V3 module (v3.0.0 or later), if you don't use the _UseRPSSession_ switch, you're using REST API cmdlets only. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
@@ -165,7 +163,7 @@ The connection examples in the following sections use modern authentication, and
165
163
2. On any other device with a web browser and internet access, open <https://microsoft.com/devicelogin> and enter the \<XXXXXXXXX\> code value from the previous step.
166
164
167
165
3. Enter your credentials on the resulting pages.
168
-
166
+
169
167
4. In the confirmation prompt, click **Continue**. The next message should indicate success, and you can close the browser or tab.
170
168
171
169
5. The command from step 1 continues to connect you to Exchange Online PowerShell.
@@ -209,7 +207,7 @@ For more information, see [Use Azure managed identities to connect to Exchange O
209
207
210
208
## Step 3: Disconnect when you're finished
211
209
212
-
Be sure to disconnect the session when you're finished. If you close the PowerShell window without disconnecting the session, you could use up all the sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the session, run the following command.
210
+
Be sure to disconnect the session when you're finished. If you close the PowerShell window without disconnecting the session, you could use up all the sessions available to you, and you need to wait for the sessions to expire. To disconnect the session, run the following command:
213
211
214
212
```powershell
215
213
Disconnect-ExchangeOnline
@@ -240,6 +238,18 @@ If you receive errors, check the following requirements:
240
238
241
239
- If your organization uses federated authentication, and your identity provider (IDP) and/or security token service (STS) isn't publicly available, you can't use a federated account to connect to Exchange Online PowerShell. Instead, create and use a non-federated account in Microsoft 365 to connect to Exchange Online PowerShell.
242
240
241
+
- REST-based connections to Exchange Online PowerShell require the PowerShellGet module, and by dependency, the PackageManagement module, so you'll receive errors if you try to connect without having them installed. For example, you might see the following error:
242
+
243
+
> The term 'Update-ModuleManifest' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
244
+
245
+
For more information about the PowerShellGet and PackageManagement module requirements, see [PowerShellGet for REST-based connections in Windows](exchange-online-powershell-v2.md#powershellget-for-rest-based-connections-in-windows).
246
+
247
+
- After you connect, you might received an error that looks like this:
248
+
249
+
> Could not load file or assembly 'System.IdentityModel.Tokens.Jwt,Version=\<Version\>, Culture=neutral, PublicKeyToken=\<TokenValue\>'. Could not find or load a specific file.
250
+
251
+
This error happens when the Exchange Online PowerShell module conflicts with another module that's imported into the runspace. Try connecting in a new Windows PowerShell window before importing other modules.
252
+
243
253
## Appendix: Comparison of old and new connection methods
244
254
245
255
This section attempts to compare older connection methods that have been replaced by the Exchange Online PowerShell module. The Basic authentication and OAuth token procedures are included for historical reference only and are no longer supported.
@@ -400,6 +410,9 @@ This section attempts to compare older connection methods that have been replace
400
410
401
411
-**Certificate thumbprint**:
402
412
413
+
> [!NOTE]
414
+
> The CertificateThumbprint parameter is supported only in Microsoft Windows.
0 commit comments