Skip to content

Commit 32ffc69

Browse files
authored
Merge branch 'master' into patch-318
2 parents 7a28790 + 6909933 commit 32ffc69

File tree

638 files changed

+29671
-23493
lines changed

Some content is hidden

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

638 files changed

+29671
-23493
lines changed

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

Lines changed: 69 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ To use the older Exchange Online Remote PowerShell Module to connect to Exchange
2727

2828
## What do you need to know before you begin?
2929

30-
- The requirements for installing and using the EXO V2 module are described in [Install and maintain the EXO V2 module](exchange-online-powershell-v2.md#install-and-maintain-the-exo-v2-module). The rest of the instructions in the article assume that you've already installed the module.
30+
- The requirements for installing and using the EXO V2 module are described in [Install and maintain the EXO V2 module](exchange-online-powershell-v2.md#install-and-maintain-the-exo-v2-module).
31+
32+
> [!NOTE]
33+
> The rest of the instructions in the article assume that you've already installed the module.
3134
3235
- 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](https://docs.microsoft.com/exchange/permissions-exo/permissions-exo).
3336

@@ -40,7 +43,9 @@ To use the older Exchange Online Remote PowerShell Module to connect to Exchange
4043

4144
If your account uses multi-factor authentication, use the steps in this section. Otherwise, skip to the [Connect to Exchange Online PowerShell using modern authentication](#connect-to-exchange-online-powershell-using-modern-authentication) section.
4245

43-
1. In a Windows PowerShell window, load the EXO V2 module by running the following command:
46+
**Note**: For other sign in methods that are available in PowerShell 7, see the [PowerShell 7 log in experiences](#powershell-7-log-in-experiences) section later in this topic.
47+
48+
1. In a PowerShell window, load the EXO V2 module by running the following command:
4449

4550
```powershell
4651
Import-Module ExchangeOnlineManagement
@@ -51,48 +56,49 @@ If your account uses multi-factor authentication, use the steps in this section.
5156
2. The command that you need to run uses the following syntax:
5257

5358
```powershell
54-
Connect-ExchangeOnline -UserPrincipalName <UPN> -ShowProgress $true [-ExchangeEnvironmentName <Value>] [-DelegatedOrganization <String>] [-PSSessionOption $ProxyOptions]
59+
Connect-ExchangeOnline -UserPrincipalName <UPN> [-ExchangeEnvironmentName <Value>] [-DelegatedOrganization <String>] [-PSSessionOption $ProxyOptions]
5560
```
5661

5762
- _\<UPN\>_ is your account in user principal name format (for example, `[email protected]`).
5863
- When you use the _ExchangeEnvironmentName_ parameter, you don't need use the _ConnectionUri_ or _AzureADAuthorizationEndPointUrl_ parameters. For more information, see the parameter descriptions in [Connect-ExchangeOnline](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
5964
- The _DelegatedOrganization_ parameter specifies the customer organization that you want to manage as an authorized Microsoft Partner. For more information, see [Partners](https://docs.microsoft.com/office365/servicedescriptions/office-365-platform-service-description/partners).
6065
- If you're behind a proxy server, run this command first: `$ProxyOptions = New-PSSessionOption -ProxyAccessType <Value>`, where \<Value\> is `IEConfig`, `WinHttpConfig`, or `AutoDetect`. Then, use the _PSSessionOption_ parameter with the value `$ProxyOptions`. For more information, see [New-PSSessionOption](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/new-pssessionoption).
66+
- The progress bar is now shown by default, so `-ShowProgress $true` is no longer required. To hide the progress bar, use this exact syntax: `-ShowProgress:$false`.
6167

6268
**This example connects to Exchange Online PowerShell in a Microsoft 365 or Microsoft 365 GCC organization**:
6369

6470
```powershell
65-
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true
71+
Connect-ExchangeOnline -UserPrincipalName [email protected]
6672
```
6773

6874
**This example connects to Exchange Online PowerShell in an Office 365 Germany organization**:
6975

7076
```powershell
71-
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true -ExchangeEnvironmentName O365GermanyCloud
77+
Connect-ExchangeOnline -UserPrincipalName [email protected] -ExchangeEnvironmentName O365GermanyCloud
7278
```
7379

7480
**This example connects to Exchange Online PowerShell in a Microsoft GCC High organization**:
7581

7682
```powershell
77-
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true -ExchangeEnvironmentName O365USGovGCCHigh
83+
Connect-ExchangeOnline -UserPrincipalName [email protected] -ExchangeEnvironmentName O365USGovGCCHigh
7884
```
7985

8086
**This example connects to Exchange Online PowerShell in a Microsoft 365 DoD organization**:
8187

8288
```powershell
83-
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true -ExchangeEnvironmentName O365USGovDoD
89+
Connect-ExchangeOnline -UserPrincipalName [email protected] -ExchangeEnvironmentName O365USGovDoD
8490
```
8591

8692
**This example connects to Exchange Online PowerShell to manage another tenant**:
8793

8894
```powershell
89-
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true -DelegatedOrganization adatum.onmicrosoft.com
95+
Connect-ExchangeOnline -UserPrincipalName [email protected] -DelegatedOrganization adatum.onmicrosoft.com
9096
```
9197

9298
For detailed syntax and parameter information, see [Connect-ExchangeOnline](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
9399

94100
> [!NOTE]
95-
> Be sure to disconnect the remote PowerShell session when you're finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command.
101+
> Be sure to disconnect the remote PowerShell session when you're finished. If you close the PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command.
96102
97103
```powershell
98104
Disconnect-ExchangeOnline
@@ -102,7 +108,9 @@ Disconnect-ExchangeOnline
102108

103109
If your account doesn't use multi-factor authentication, use the steps in this section.
104110

105-
1. In a Windows PowerShell window, load the EXO V2 module by running the following command:
111+
**Note**: For other sign in methods that are available in PowerShell 7, see the [PowerShell 7 log in experiences](#powershell-7-log-in-experiences) section later in this topic.
112+
113+
1. In a PowerShell window, load the EXO V2 module by running the following command:
106114

107115
```powershell
108116
Import-Module ExchangeOnlineManagement
@@ -119,60 +127,102 @@ If your account doesn't use multi-factor authentication, use the steps in this s
119127
$UserCredential = Get-Credential
120128
```
121129

122-
In the **Windows PowerShell Credential Request** dialog box that appears, type your work or school account and password, and then click **OK**.
130+
In the credentials prompt, enter your work or school account and password.
123131

124132
3. The last command that you need to run uses the following syntax:
125133

126134
```powershell
127-
Connect-ExchangeOnline [-Credential $UserCredential] -ShowProgress $true [-ShowBanner:$false] [-ExchangeEnvironmentName <Value>] [-DelegatedOrganization <String>] [-PSSessionOption $ProxyOptions]
135+
Connect-ExchangeOnline [-Credential $UserCredential] [-ShowBanner:$false] [-ExchangeEnvironmentName <Value>] [-DelegatedOrganization <String>] [-PSSessionOption $ProxyOptions]
128136
```
129137

130138
- When you use the _ExchangeEnvironmentName_ parameter, you don't need use the _ConnectionUri_ or _AzureADAuthorizationEndPointUrl_ parameters. For more information, see the parameter descriptions in [Connect-ExchangeOnline](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
131139
- The _DelegatedOrganization_ parameter specifies the customer organization that you want to manage as an authorized Microsoft Partner. For more information, see [Partners](https://docs.microsoft.com/office365/servicedescriptions/office-365-platform-service-description/partners).
132140
- If you're behind a proxy server, store the output of the [New-PSSessionOption](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/new-pssessionoption) cmdlet in a variable (for example, `$ProxyOptions = New-PSSessionOption -ProxyAccessType <Value> [-ProxyAuthentication <Value>] [-ProxyCredential <Value>]`). Then, use the variable (`$ProxyOptions`) as the value for the _PSSessionOption_ parameter.
141+
- The progress bar is now shown by default, so `-ShowProgress $true` is no longer required. To hide the progress bar, use this exact syntax: `-ShowProgress:$false`.
133142

134143
**Connect to Exchange Online PowerShell in a Microsoft 365 or Microsoft 365 GCC organization**:
135144

136145
```powershell
137-
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true
146+
Connect-ExchangeOnline -Credential $UserCredential
138147
```
139148

140149
**Connect to Exchange Online PowerShell in an Office 365 Germany organization**:
141150

142151
```powershell
143-
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true -ExchangeEnvironmentName O365GermanyCloud
152+
Connect-ExchangeOnline -Credential $UserCredential -ExchangeEnvironmentName O365GermanyCloud
144153
```
145154

146155
**Connect to Exchange Online PowerShell in an Office 365 operated by 21Vianet organization**:
147156

148157
```powershell
149-
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true -ExchangeEnvironmentName O365China
158+
Connect-ExchangeOnline -Credential $UserCredential -ExchangeEnvironmentName O365China
150159
```
151160

152161
**Connect to Exchange Online PowerShell in a Microsoft 365 GCC High organization**:
153162

154163
```powershell
155-
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true -ExchangeEnvironmentName O365USGovGCCHigh
164+
Connect-ExchangeOnline -Credential $UserCredential -ExchangeEnvironmentName O365USGovGCCHigh
156165
```
157166

158167
**Connect to Exchange Online PowerShell in a Microsoft 365 DoD organization**:
159168

160169
```powershell
161-
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true -ExchangeEnvironmentName O365USGovDoD
170+
Connect-ExchangeOnline -Credential $UserCredential -ExchangeEnvironmentName O365USGovDoD
162171
```
163172

164173
For detailed syntax and parameter information, see [Connect-ExchangeOnline](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
165174

166175
> [!NOTE]
167-
> Be sure to disconnect the remote PowerShell session when you're finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command:
176+
> Be sure to disconnect the remote PowerShell session when you're finished. If you close the PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command:
168177
169178
```powershell
170179
Disconnect-ExchangeOnline
171180
```
172181

182+
## PowerShell 7 log in experiences
183+
184+
This section describes the log in experiences that are available in version 2.0.4 or later of the EXO V2 module in PowerShell 7.
185+
186+
For more information about the operating systems that are supported by the EXO V2 module in PowerShell 7, see [Supported operating systems for the EXO V2 module](exchange-online-powershell-v2.md#supported-operating-systems-for-the-exo-v2-module).
187+
188+
For detailed syntax and parameter information, see [Connect-ExchangeOnline](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
189+
190+
### Interactive scripting using browser-based single sign-on
191+
192+
Browser-based single sign-on (SSO) is the default log in method in PowerShell 7. The **Connect-ExchangeOnline** command opens the Azure AD login page in the default browser. After you enter your credentials, older Exchange Online cmdlets and EXO V2 module cmdlets are available in the resulting PowerShell session.
193+
194+
If you use the _UserPrincipalName_ parameter in the command, the UPN value is used on the login page in the browser.
195+
196+
```powershell
197+
Connect-ExchangeOnline -UserPrincipalName [email protected]
198+
```
199+
200+
### Device-based log in
201+
202+
Use device-based log in when no browser is available (and therefore, you can't see the login page):
203+
204+
```powershell
205+
Connect-ExchangeOnline -Device
206+
```
207+
208+
The command returns a URL and unique code that's tied to the session. You need to open the URL in a browser on any computer, and then enter the unique code. After you complete the login in the web browser, the session in the Powershell 7 window is authenticated via the regular Azure AD authentication flow, and the Exchange Online cmdlets are imported after few seconds.
209+
210+
### Inline credentials
211+
212+
You can enter your credentials directly in the PowerShell window without the need to go to the browser for SSO.
213+
214+
> [!NOTE]
215+
> This method does not work with accounts that use multi-factor authentication.
216+
217+
This method is an improvement on the _Credential_ parameter, because you don't need to store the credentials locally in a script, and you can enter the credentials directly in an interactive PowerShell session.
218+
219+
```powershell
220+
Connect-ExchangeOnline -InlineCredential
221+
```
222+
173223
## How do you know this worked?
174224

175-
The Exchange Online cmdlets are imported into your local Windows PowerShell session and tracked by a progress bar. If you don't receive any errors, you connected successfully. A quick test is to run an Exchange Online PowerShell cmdlet, for example, **Get-Mailbox**, and see the results.
225+
The Exchange Online cmdlets are imported into your local PowerShell session and tracked by a progress bar. If you don't receive any errors, you connected successfully. A quick test is to run an Exchange Online PowerShell cmdlet, for example, **Get-Mailbox**, and see the results.
176226

177227
If you receive errors, check the following requirements:
178228

0 commit comments

Comments
 (0)