Skip to content

Commit 75c705b

Browse files
committed
Merge branch 'master' into DLPv2-chrisda
2 parents 249ef7c + 31de4c2 commit 75c705b

File tree

505 files changed

+3678
-2417
lines changed

Some content is hidden

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

505 files changed

+3678
-2417
lines changed

exchange/docs-conceptual/app-only-auth-powershell-v2.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ms.collection: Strat_EX_Admin
1313
ms.custom:
1414
ms.assetid:
1515
search.appverid: MET150
16-
ROBOTS: NOINDEX, NOFOLLOW
1716
description: "Learn about using the Exchange Online V2 module in scripts and other long-running tasks with modern authentication and app-only authentication."
1817
---
1918

@@ -50,6 +49,9 @@ The following examples show how to use the Exchange Online PowerShell V2 module
5049

5150
When you use the _Certificate_ parameter, the certificate does not need to be installed on the computer where you are running the command. This parameter is applicable for scenarios where the certificate object is stored remotely and fetched at runtime during script execution.
5251

52+
> [!TIP]
53+
> In the **Connect-ExchangeOnline** commands, be sure to use an `.onmicrosoft.com` domain in the _Organization_ parameter value. Otherwise, you might encounter cryptic permission issues when you run commands in the app context.
54+
5355
## How does it work?
5456

5557
The EXO V2 module uses the Active Directory Authentication Library to fetch an app-only token using the application Id, tenant Id (organization), and certificate thumbprint. The application object provisioned inside Azure AD has a Directory Role assigned to it, which is returned in the access token. Exchange Online configures the session RBAC using the directory role information that's available in the token.
@@ -121,25 +123,27 @@ If you encounter problems, check the [required permssions](https://docs.microsof
121123

122124
You need to assign the API permission `Exchange.ManageAsApp` so the application can manage Exchange Online. API permissions are required because they have consent flow enabled, which allows auditing (directory roles don't have consent flow).
123125

124-
1. Select **API permissions**.
125-
126-
2. In the **Configured permissions** page that appears, click **Add permission**.
127-
128-
3. In the flyout that appears, select **Exchange**.
129-
130-
![Select Exchange API permssions](media/app-only-auth-exchange-api-perms.png)
131-
132-
4. In the flyout that appears, click **Application permissions**.
126+
1. Select **Manifest** in the left-hand navigation under **Manage**.
133127

134-
5. In the **Select permissions** section that appears on the page, expand **Exchange** and select **Exchange.ManageAsApp**
128+
2. Locate the `requiredResourceAccess` property in the manifest, and add the following inside the square brackets (`[]`):
135129

136-
![Select Exchange.ManageAsApp permssions](media/app-only-auth-exchange-manageasapp.png)
130+
```json
131+
{
132+
"resourceAppId": "00000002-0000-0ff1-ce00-000000000000",
133+
"resourceAccess": [
134+
{
135+
"id": "dc50a0fb-09a3-484d-be87-e023b12c6440",
136+
"type": "Role"
137+
}
138+
]
139+
}
140+
```
137141

138-
When you're finished, click **Add permissions**.
142+
3. Select **Save**.
139143

140-
6. Back on the **Configured permissions** page that appears, click **Grant admin consent for \<tenant name\>**, and select **Yes** in the dialog that appears.
144+
4. Select **API permissions** under **Manage**. Confirm that the **Exchange.ManageAsApp** permission is listed.
141145

142-
7. Close the flyout when you're finished.
146+
5. Select **Grant admin consent for org** and accept the consent dialog.
143147

144148
## Step 3: Generate a self-signed certificate
145149

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ To use the older Exchange Online Remote PowerShell Module to connect to Exchange
3434
> [!TIP]
3535
> Having problems? Ask in the [Exchange Online](https://go.microsoft.com/fwlink/p/?linkId=267542) forum.
3636
37-
## Connect to Exchange Online PowerShell using MFA
37+
## Connect to Exchange Online PowerShell using MFA and modern authentication
3838

39-
If your account uses multi-factor authentication, use the steps in this section. Otherwise, skip to the [Connect to Exchange Online PowerShell without using MFA](#connect-to-exchange-online-powershell-without-using-mfa) section.
39+
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.
4040

4141
1. In a Windows PowerShell window, load the EXO V2 module by running the following command:
4242

@@ -84,7 +84,7 @@ If your account uses multi-factor authentication, use the steps in this section.
8484
**This example connects to Exchange Online PowerShell to manage another tenant**:
8585

8686
```powershell
87-
Connect-ExchangeOnline -UserPrincipalName [email protected] -DelegatedOrganization adatum.onmicrosoft.com
87+
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true -DelegatedOrganization adatum.onmicrosoft.com
8888
```
8989

9090
For detailed syntax and parameter information, see [Connect-ExchangeOnline](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
@@ -96,7 +96,7 @@ For detailed syntax and parameter information, see [Connect-ExchangeOnline](http
9696
Disconnect-ExchangeOnline
9797
```
9898

99-
## Connect to Exchange Online PowerShell without using MFA
99+
## Connect to Exchange Online PowerShell using modern authentication
100100

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

@@ -110,21 +110,24 @@ If your account doesn't use multi-factor authentication, use the steps in this s
110110

111111
2. Run the following command:
112112

113+
> [!NOTE]
114+
> You can skip this step and omit the _Credential_ parameter in the next step to be prompted to enter the username and password after you run the **Connect-ExchangeOnline** command. If you omit the _Credential_ parameter and include the _UserPrincipalName_ parameter in the next step, you're only prompted to enter the password after you run the **Connect-ExchangeOnline** command.
115+
113116
```powershell
114117
$UserCredential = Get-Credential
115118
```
116119

117120
In the **Windows PowerShell Credential Request** dialog box that appears, type your work or school account and password, and then click **OK**.
118121

119-
3. The command that you need to run uses the following syntax:
122+
3. The last command that you need to run uses the following syntax:
120123

121124
```powershell
122-
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true [-ExchangeEnvironmentName <Value>] [-DelegatedOrganization <String>] [-PSSessionOption $ProxyOptions]
125+
Connect-ExchangeOnline [-Credential $UserCredential] -ShowProgress $true [-ShowBanner:$false] [-ExchangeEnvironmentName <Value>] [-DelegatedOrganization <String>] [-PSSessionOption $ProxyOptions]
123126
```
124127

125128
- 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).
126129
- 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).
127-
- 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).
130+
- 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.
128131

129132
**Connect to Exchange Online PowerShell in a Microsoft 365 or Microsoft 365 GCC organization**:
130133

@@ -159,7 +162,7 @@ If your account doesn't use multi-factor authentication, use the steps in this s
159162
For detailed syntax and parameter information, see [Connect-ExchangeOnline](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
160163

161164
> [!NOTE]
162-
> 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.
165+
> 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:
163166
164167
```powershell
165168
Disconnect-ExchangeOnline
@@ -171,11 +174,11 @@ The Exchange Online cmdlets are imported into your local Windows PowerShell sess
171174

172175
If you receive errors, check the following requirements:
173176

174-
- A common problem is an incorrect password. Run the three steps again and pay close attention to the user name and password you enter in Step 1.
177+
- A common problem is an incorrect password. Run the three steps again and pay close attention to the username and password that you use.
175178

176179
- To help prevent denial-of-service (DoS) attacks, you're limited to five open remote PowerShell connections to Exchange Online.
177180

178-
- The account you use to connect to must be enabled for remote PowerShell. For more information, see [Enable or disable access to Exchange Online PowerShell](disable-access-to-exchange-online-powershell.md).
181+
- The account that you use to connect to must be enabled for remote PowerShell. For more information, see [Enable or disable access to Exchange Online PowerShell](disable-access-to-exchange-online-powershell.md).
179182

180183
- 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.
181184

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ To use the older, less secure remote PowerShell connection instructions that [wi
3434
> [!TIP]
3535
> Having problems? Ask for help in the [Exchange Online Protection](https://go.microsoft.com/fwlink/p/?linkId=285351) forum.
3636
37-
## Connect to Exchange Online Protection PowerShell using MFA
37+
## Connect to Exchange Online Protection PowerShell using MFA and modern authentication
3838

39-
If your account uses multi-factor authentication, use the steps in this section. Otherwise, skip to the [Connect to Exchange Online Protection PowerShell without using MFA](#connect-to-exchange-online-protection-powershell-without-using-mfa) section.
39+
If your account uses multi-factor authentication, use the steps in this section. Otherwise, skip to the [Connect to Exchange Online Protection PowerShell using modern authentication](#connect-to-exchange-online-protection-powershell-using-modern-authentication) section.
4040

4141
1. In a Windows PowerShell window, load the EXO V2 module by running the following command:
4242

@@ -77,7 +77,7 @@ For detailed syntax and parameter information, see [Connect-IPPSSession](https:/
7777
Disconnect-ExchangeOnline
7878
```
7979

80-
## Connect to Exchange Online Protection PowerShell without using MFA
80+
## Connect to Exchange Online Protection PowerShell using modern authentication
8181

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

@@ -91,20 +91,23 @@ If your account doesn't use multi-factor authentication, use the steps in this s
9191

9292
2. Run the following command:
9393

94+
> [!NOTE]
95+
> You can skip this step and omit the _Credential_ parameter in the next step to be prompted to enter the username and password after you run the **Connect-IPPSSession** command. If you omit the _Credential_ parameter and include the _UserPrincipalName_ parameter in the next step, you're only prompted to enter the password after you run the **Connect-IPPSSession** command.
96+
9497
```powershell
9598
$UserCredential = Get-Credential
9699
```
97100

98101
In the **Windows PowerShell Credential Request** dialog box that appears, type your work or school account and password, and then click **OK**.
99102

100-
3. The command that you need to run uses the following syntax:
103+
3. The last command that you need to run uses the following syntax:
101104

102105
```powershell
103-
Connect-IPPSSession -Credential $UserCredential -ConnectionUri <URL> [-PSSessionOption $ProxyOptions]
106+
Connect-IPPSSession [-Credential $UserCredential] -ConnectionUri <URL> [-PSSessionOption $ProxyOptions]
104107
```
105108

106109
- The required _ConnectionUri_ value depends on the nature of your Microsoft 365 organization. For more information, see the parameter description in [Connect-IPPSSession](https://docs.microsoft.com/powershell/module/exchange/connect-ippssession).
107-
- 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).
110+
- 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.
108111

109112
**This example connects to Exchange Online Protection PowerShell in a Microsoft 365 organization**:
110113

@@ -121,7 +124,7 @@ If your account doesn't use multi-factor authentication, use the steps in this s
121124
For detailed syntax and parameter information, see [Connect-IPPSSession](https://docs.microsoft.com/powershell/module/exchange/connect-exchangeonline).
122125

123126
> [!NOTE]
124-
> 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.
127+
> 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:
125128
126129
```powershell
127130
Disconnect-ExchangeOnline
@@ -133,13 +136,13 @@ The Exchange Online Protection Protection cmdlets are imported into your local W
133136

134137
If you receive errors, check the following requirements:
135138

136-
- A common problem is an incorrect password. Run the three steps again and pay close attention to the user name and password you enter in Step 1.
139+
- A common problem is an incorrect password. Run the three steps again and pay close attention to the username and password that you use.
137140

138141
- To help prevent denial-of-service (DoS) attacks, you're limited to five open remote PowerShell connections to Exchange Online Protection.
139142

140143
- 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.
141144

142-
- The account you use to connect to Exchange Online Protection PowerShell must be represented as a [mail user in EOP](https://docs.microsoft.com/microsoft-365/security/office-365-security/manage-mail-users-in-eop) (created manually or by directory synchronization). If the account is not visible in the Exchange admin center (EAC) as a mail user at **Recipients** \> **Contacts**, you'll receive the following error when you try to connect:
145+
- The account that you use to connect to Exchange Online Protection PowerShell must be represented as a [mail user in EOP](https://docs.microsoft.com/microsoft-365/security/office-365-security/manage-mail-users-in-eop) (created manually or by directory synchronization). If the account is not visible in the Exchange admin center (EAC) as a mail user at **Recipients** \> **Contacts**, you'll receive the following error when you try to connect:
143146

144147
> Import-PSSession : Running the Get-Command command in a remote session reported the following error: Processing data for a remote command failed with the following error message: The request for the Windows Remote Shell with ShellId <GUID> failed because the shell was not found on the server. Possible causes are: the specified ShellId is incorrect or the shell no longer exists on the server. Provide the correct ShellId or create a new shell and retry the operation.
145148

0 commit comments

Comments
 (0)