Skip to content

Commit bc5cad9

Browse files
authored
Merge pull request #12916 from MicrosoftDocs/EOP-chrisda
EOP-chrisda to Main
2 parents 88818e4 + 9eab273 commit bc5cad9

File tree

48 files changed

+377
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+377
-435
lines changed

exchange/docs-conceptual/connect-to-exchange-online-powershell.md

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Connect to Exchange Online PowerShell
33
author: chrisda
44
manager: deniseb
5-
ms.date: 05/07/2025
5+
ms.date: 07/11/2025
66
ms.audience: Admin
77
audience: Admin
88
ms.topic: article
@@ -13,14 +13,17 @@ ms.collection: Strat_EX_Admin
1313
ms.custom:
1414
ms.assetid:
1515
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)."
1717
---
1818

1919
# Connect to Exchange Online PowerShell
2020

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).
2222

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).
2427

2528
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).
2629

@@ -30,24 +33,18 @@ To connect to Exchange Online PowerShell from C#, see [Use C# to connect to Exch
3033

3134
- 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).
3235

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).
3737

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).
3939

4040
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).
4141

42-
> [!TIP]
43-
> Having problems? Ask in the [Exchange Online](https://go.microsoft.com/fwlink/p/?linkId=267542) forum.
44-
4542
## Step 1: Load the Exchange Online PowerShell module
4643

4744
> [!NOTE]
4845
> If the module is already installed, you can typically skip this step and run **Connect-ExchangeOnline** without manually loading the module first.
4946
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:
5148

5249
```powershell
5350
Import-Module ExchangeOnlineManagement
@@ -56,12 +53,12 @@ Import-Module ExchangeOnlineManagement
5653
## Step 2: Connect and authenticate
5754

5855
> [!NOTE]
59-
> 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.
6057
6158
The command that you need to run uses the following syntax:
6259

6360
```powershell
64-
Connect-ExchangeOnline -UserPrincipalName <UPN> [-ExchangeEnvironmentName <Value>] [-ShowBanner:$false] [-LoadCmdletHelp] [-DelegatedOrganization <String>] [-SkipLoadingFormatData] [-DisableWAM]
61+
Connect-ExchangeOnline [-UserPrincipalName <UPN>] [-ExchangeEnvironmentName <Value>] [-ShowBanner:$false] [-LoadCmdletHelp] [-DelegatedOrganization <String>] [-SkipLoadingFormatData] [-DisableWAM]
6562
```
6663

6764
For detailed syntax and parameter information, see [Connect-ExchangeOnline](/powershell/module/exchange/connect-exchangeonline).
@@ -90,13 +87,13 @@ For detailed syntax and parameter information, see [Connect-ExchangeOnline](/pow
9087

9188
- Use the _SkipLoadingFormatData_ switch to avoid errors when connecting to Exchange Online PowerShell from within a Windows service.
9289

93-
- Using the module in PowerShell 7 requires version 2.0.4 or later.
90+
- PowerShell 7 requires version 2.0.4 or later.
9491

9592
- In version 3.7.2 or later, the _DisableWAM_ switch is available to disable Web Account Manager (WAM) if you get WAM-related connection errors.
9693

9794
The connection examples in the following sections use modern authentication, and are incapable of using Basic authentication.
9895

99-
### Connect to Exchange Online PowerShell with an interactive login prompt
96+
### Connect to Exchange Online PowerShell with an interactive sign in prompt
10097

10198
1. The following examples work in Windows PowerShell 5.1 and PowerShell 7 for accounts with or without MFA:
10299

@@ -124,16 +121,16 @@ The connection examples in the following sections use modern authentication, and
124121
Connect-ExchangeOnline -UserPrincipalName [email protected] -ExchangeEnvironmentName O365GermanyCloud
125122
```
126123
127-
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**.
128125
129126
![Enter your password in the Sign in to your account window.](media/connect-exo-password-prompt.png)
130127
131128
> [!NOTE]
132129
> 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.
133130
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).
135132
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**.
137134
138135
![Enter your verification code in the Sign in to your account window.](media/connect-exo-mfa-verify-prompt.png)
139136
@@ -163,17 +160,17 @@ The connection examples in the following sections use modern authentication, and
163160
164161
3. Enter your credentials on the resulting pages.
165162
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.
167164
168165
5. The command from step 1 continues to connect you to Exchange Online PowerShell.
169166
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)
171168
172169
For complete instructions, see [App-only authentication for unattended scripts in Exchange Online PowerShell and Security & Compliance PowerShell](app-only-auth-powershell-v2.md).
173170
174171
### Connect to Exchange Online PowerShell in customer organizations
175172
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:
177174
178175
- [What is the Cloud Solution Provider (CSP) program?](/partner-center/csp-overview).
179176
- [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:
182179
183180
- Connect to a customer organization using a CSP account.
184181
- Connect to a customer organization using a GDAP.
185-
- Connect to a customer organization as a guest user.
182+
- Connect to a customer organization as a guest.
186183
187184
```powershell
188185
Connect-ExchangeOnline -UserPrincipalName [email protected] -DelegatedOrganization adatum.onmicrosoft.com
@@ -219,11 +216,11 @@ Disconnect-ExchangeOnline -Confirm:$false
219216
```
220217

221218
> [!NOTE]
222-
> 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.
223220
224-
## How do you know you've connected successfully?
221+
## How do you know you connected successfully?
225222

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.
227224

228225
If you receive errors, check the following requirements:
229226

@@ -233,25 +230,25 @@ If you receive errors, check the following requirements:
233230

234231
- 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.
235232

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.
237234

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:
239236

240237
> 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.
241238
242239
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).
243240

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:
245242

246243
> Could not load file or assembly 'System.IdentityModel.Tokens.Jwt,Version=\<Version\>, Culture=neutral, PublicKeyToken=\<TokenValue\>'. Could not find or load a specific file.
247244
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.
249246

250247
## Appendix: Comparison of old and new connection methods
251248

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.
253250

254-
### Connect without multi-factor authentication
251+
### Connect without multifactor authentication
255252

256253
- **Exchange Online PowerShell module with interactive credential prompt**:
257254

@@ -293,7 +290,7 @@ This section attempts to compare older connection methods that have been replace
293290
Import-PSSession $Session
294291
```
295292

296-
### Connect with multi-factor authentication
293+
### Connect with multifactor authentication
297294

298295
- **Exchange Online PowerShell module with interactive credential prompt**:
299296

@@ -369,7 +366,7 @@ This section attempts to compare older connection methods that have been replace
369366
Import-PSSession $Session
370367
```
371368

372-
### Connect to a customer organization as a guest user
369+
### Connect to a customer organization as a guest
373370

374371
- **Exchange Online PowerShell module**:
375372

0 commit comments

Comments
 (0)