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/connect-to-exchange-online-powershell.md
+32-35Lines changed: 32 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Connect to Exchange Online PowerShell
3
3
author: chrisda
4
4
manager: deniseb
5
-
ms.date: 05/07/2025
5
+
ms.date: 07/11/2025
6
6
ms.audience: Admin
7
7
audience: Admin
8
8
ms.topic: article
@@ -13,14 +13,17 @@ ms.collection: Strat_EX_Admin
13
13
ms.custom:
14
14
ms.assetid:
15
15
search.appverid: MET150
16
-
description: "Learn how to use the Exchange Online PowerShell V3 module to connect to Exchange Online PowerShell with modern authentication and/or multi-factor authentication (MFA)."
16
+
description: "Learn how to use the Exchange Online PowerShell V3 module to connect to Exchange Online PowerShell with modern authentication and/or multifactor authentication (MFA)."
17
17
---
18
18
19
19
# Connect to Exchange Online PowerShell
20
20
21
-
This article contains instructions for how to connect to Exchange Online PowerShell using the Exchange Online PowerShell module with or without multi-factor authentication (MFA).
21
+
This article contains instructions for how to connect to Exchange Online PowerShell using the Exchange Online PowerShell module with or without multifactor authentication (MFA).
22
22
23
-
The Exchange Online PowerShell module uses modern authentication for connecting to all Exchange-related PowerShell environments in Microsoft 365: Exchange Online PowerShell, Security & Compliance PowerShell, and standalone Exchange Online Protection (EOP) PowerShell. For more information about the Exchange Online PowerShell module, see [About the Exchange Online PowerShell module](exchange-online-powershell-v2.md).
23
+
> [!TIP]
24
+
> The connection instructions in this article also apply to Exchange Online Protection PowerShell for cloud protection of on-premises email environments without cloud mailboxes.
25
+
26
+
The Exchange Online PowerShell module uses modern authentication for connecting to Exchange Online PowerShell and Security & Compliance PowerShell. For more information about the Exchange Online PowerShell module, see [About the Exchange Online PowerShell module](exchange-online-powershell-v2.md).
24
27
25
28
To connect to Exchange Online PowerShell for automation, see [App-only authentication for unattended scripts](app-only-auth-powershell-v2.md) and [Use Azure managed identities to connect to Exchange Online PowerShell](connect-exo-powershell-managed-identity.md).
26
29
@@ -30,24 +33,18 @@ To connect to Exchange Online PowerShell from C#, see [Use C# to connect to Exch
30
33
31
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).
32
35
33
-
> [!NOTE]
34
-
> Remote PowerShell connections are deprecated in Exchange Online PowerShell. For more information, see [Deprecation of Remote PowerShell in Exchange Online](https://techcommunity.microsoft.com/t5/exchange-team-blog/deprecation-of-remote-powershell-in-exchange-online-re-enabling/ba-p/3779692).
35
-
>
36
-
> REST API connections in the Exchange Online PowerShell V3 module require the PowerShellGet and PackageManagement modules. For more information, see [PowerShellGet for REST-based connections in Windows](exchange-online-powershell-v2.md#powershellget-for-rest-api-connections-in-windows).
36
+
- REST API connections in the Exchange Online PowerShell V3 module require the PowerShellGet and PackageManagement modules. For more information, see [PowerShellGet for REST-based connections in Windows](exchange-online-powershell-v2.md#powershellget-for-rest-api-connections-in-windows).
37
37
38
-
- After you connect, the cmdlets and parameters that you have or don't have access to is controlled by role-based access control (RBAC). For more information, see [Permissions in Exchange Online](/exchange/permissions-exo/permissions-exo).
38
+
- After you connect, role-based access control (RBAC) controls the cmdlets and parameters that you have or don't have access to. For more information, see [Permissions in Exchange Online](/exchange/permissions-exo/permissions-exo).
39
39
40
40
To find the permissions that are required to run specific Exchange Online cmdlets, see [Find the permissions required to run any Exchange cmdlet](find-exchange-cmdlet-permissions.md).
41
41
42
-
> [!TIP]
43
-
> Having problems? Ask in the [Exchange Online](https://go.microsoft.com/fwlink/p/?linkId=267542) forum.
44
-
45
42
## Step 1: Load the Exchange Online PowerShell module
46
43
47
44
> [!NOTE]
48
45
> If the module is already installed, you can typically skip this step and run **Connect-ExchangeOnline** without manually loading the module first.
49
46
50
-
After you've [installed the module](exchange-online-powershell-v2.md#install-and-maintain-the-exchange-online-powershell-module), open a PowerShell window and load the module by running the following command:
47
+
After you[install the module](exchange-online-powershell-v2.md#install-and-maintain-the-exchange-online-powershell-module), open a PowerShell window and load the module by running the following command:
> Connect commands will likely fail if the profile path of the account that you used to connect contains special PowerShell characters (for example, `$`). The workaround is to connect using a different account that doesn't have special characters in the profile path.
56
+
> Connect commands likely fail if the profile path of the account that you used to connect contains special PowerShell characters (for example, `$`). The workaround is to connect using a different account that doesn't have special characters in the profile path.
60
57
61
58
The command that you need to run uses the following syntax:
2. In the sign-in window that opens, enter your password, and then click **Sign in**.
124
+
2. In the sign-in window that opens, enter your password, and then select **Sign in**.
128
125
129
126

130
127
131
128
> [!NOTE]
132
129
> In PowerShell 7, browser-based single sign-on (SSO) is used by default, so the sign-in prompt opens in your default web browser instead of a standalone dialog.
133
130
134
-
3. **MFA only**: A verification code is generated and delivered based on the response option that's configured for your account (for example, a text message or the Microsoft Authenticator app on your device).
131
+
3. **MFA only**: A verification code is generated and delivered based on the response option configured for your account (for example, a text message or the Microsoft Authenticator app on your device).
135
132
136
-
In the verification window that opens, enter the verification code, and then click **Verify**.
133
+
In the verification window that opens, enter the verification code, and then select **Verify**.
137
134
138
135

139
136
@@ -163,17 +160,17 @@ The connection examples in the following sections use modern authentication, and
163
160
164
161
3. Enter your credentials on the resulting pages.
165
162
166
-
4. In the confirmation prompt, click **Continue**. The next message should indicate success, and you can close the browser or tab.
163
+
4. In the confirmation prompt, select **Continue**. The next message should indicate success, and you can close the browser or tab.
167
164
168
165
5. The command from step 1 continues to connect you to Exchange Online PowerShell.
169
166
170
-
### Connect to Exchange Online PowerShell without a login prompt (unattended scripts)
167
+
### Connect to Exchange Online PowerShell without a sign in prompt (unattended scripts)
171
168
172
169
For complete instructions, see [App-only authentication for unattended scripts in Exchange Online PowerShell and Security & Compliance PowerShell](app-only-auth-powershell-v2.md).
173
170
174
171
### Connect to Exchange Online PowerShell in customer organizations
175
172
176
-
For more information about partners and customer organizations, see the following topics:
173
+
For more information about partners and customer organizations, see the following articles:
177
174
178
175
- [What is the Cloud Solution Provider (CSP) program?](/partner-center/csp-overview).
179
176
- [Introduction to granular delegated admin privileges (GDAP)](/partner-center/gdap-introduction)
@@ -182,7 +179,7 @@ This example connects to customer organizations in the following scenarios:
182
179
183
180
- Connect to a customer organization using a CSP account.
184
181
- Connect to a customer organization using a GDAP.
185
-
- Connect to a customer organization as a guest user.
> The disconnect command will likely fail if the profile path of the account that you used to connect contains special PowerShell characters (for example, `$`). The workaround is to connect using a different account that doesn't have special characters in the profile path.
219
+
> The disconnect command likely fails if the profile path of the account that you used to connect contains special PowerShell characters (for example, `$`). The workaround is to connect using a different account that doesn't have special characters in the profile path.
223
220
224
-
## How do you know you've connected successfully?
221
+
## How do you know you connected successfully?
225
222
226
-
If you don't receive any errors, you've connected successfully. A quick test is to run an Exchange Online PowerShell cmdlet, for example, **Get-AcceptedDomain**, and see the results.
223
+
If you don't receive any errors, you connected successfully. A quick test is to run an Exchange Online PowerShell cmdlet, for example, **Get-AcceptedDomain**, and see the results.
227
224
228
225
If you receive errors, check the following requirements:
229
226
@@ -233,25 +230,25 @@ If you receive errors, check the following requirements:
233
230
234
231
- TCP port 80 traffic needs to be open between your local computer and Microsoft 365. It's probably open, but it's something to consider if your organization has a restrictive internet access policy.
235
232
236
-
- 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.
233
+
- 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 nonfederated account in Microsoft 365 to connect to Exchange Online PowerShell.
237
234
238
-
- 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:
235
+
- REST-based connections to Exchange Online PowerShell require the PowerShellGet module. By dependency, the PowerShellGet module requires the PackageManagement module. You get errors if you try to connect without having both modules installed. For example, you might see the following error:
239
236
240
237
> 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.
241
238
242
239
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-api-connections-in-windows).
243
240
244
-
- After you connect, you might received an error that looks like this:
241
+
- After you connect, you might receive an error that looks like this:
245
242
246
243
> Could not load file or assembly 'System.IdentityModel.Tokens.Jwt,Version=\<Version\>, Culture=neutral, PublicKeyToken=\<TokenValue\>'. Could not find or load a specific file.
247
244
248
-
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.
245
+
This error happens when the Exchange Online PowerShell module conflicts with another module imported into the runspace. Try connecting in a new Windows PowerShell window before importing other modules.
249
246
250
247
## Appendix: Comparison of old and new connection methods
251
248
252
-
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.
249
+
This section attempts to compare older connection methods the Exchange Online PowerShell module replaced. The Basic authentication and OAuth token procedures are included for historical reference only and are no longer supported.
253
250
254
-
### Connect without multi-factor authentication
251
+
### Connect without multifactor authentication
255
252
256
253
-**Exchange Online PowerShell module with interactive credential prompt**:
257
254
@@ -293,7 +290,7 @@ This section attempts to compare older connection methods that have been replace
293
290
Import-PSSession $Session
294
291
```
295
292
296
-
### Connect with multi-factor authentication
293
+
### Connect with multifactor authentication
297
294
298
295
-**Exchange Online PowerShell module with interactive credential prompt**:
299
296
@@ -369,7 +366,7 @@ This section attempts to compare older connection methods that have been replace
369
366
Import-PSSession $Session
370
367
```
371
368
372
-
### Connect to a customer organization as a guest user
0 commit comments