Skip to content

Commit 4310855

Browse files
committed
Merge branch 'main' into ContMal-chrisda
2 parents 00cbf63 + 03810b9 commit 4310855

File tree

191 files changed

+2285
-1390
lines changed

Some content is hidden

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

191 files changed

+2285
-1390
lines changed

.openpublishing.publish.config.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
"notification_subscribers": [],
221221
"sync_notification_subscribers": [],
222222
"branches_to_filter": [],
223-
"git_repository_branch_open_to_public_contributors": "master",
223+
"git_repository_branch_open_to_public_contributors": "main",
224224
"skip_source_output_uploading": false,
225225
"need_preview_pull_request": true,
226226
"enable_incremental_build": false,
@@ -229,7 +229,7 @@
229229
{
230230
"path_to_root": "_themes",
231231
"url": "https://github.com/Microsoft/templates.docs.msft",
232-
"branch": "master",
232+
"branch": "main",
233233
"branch_mapping": {}
234234
}
235235
],
@@ -257,4 +257,4 @@
257257
"docs_build_engine": {
258258
"name": "docfx_v3"
259259
}
260-
}
260+
}

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

Lines changed: 94 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,65 @@ description: "Learn about using the Exchange Online V2 module in scripts and oth
2020
# App-only authentication for unattended scripts in the EXO V2 module
2121

2222
> [!NOTE]
23-
> The features and procedures described in this article require version 2.0.3 or later of the EXO V2 module. For instructions on how to install or update to this version of the module, see [Install and maintain the EXO V2 module](exchange-online-powershell-v2.md#install-and-maintain-the-exo-v2-module).
23+
> The features and procedures described in this article require the following versions of the EXO V2 module:
24+
>
25+
> - **Exchange Online PowerShell (Connect-ExchangeOnline)**: Version 2.0.3 or later.
26+
> - **Security & Compliance Center PowerShell (Connect-IPPSSession)**: Version 2.0.6 Preview5 or later.
27+
>
28+
> For instructions on how to install or update the module, see [Install and maintain the EXO V2 module](exchange-online-powershell-v2.md#install-and-maintain-the-exo-v2-module).
2429
25-
Auditing and reporting scenarios in Exchange Online often involve scripts that run unattended. In most cases, these unattended scripts access Exchange Online PowerShell using Basic authentication (a username and password). Even when the connection to Exchange Online PowerShell uses modern authentication, the credentials are stored in a local file or a secret vault that's accessed at run-time.
30+
Auditing and reporting scenarios in Microsoft 365 often involve unattended scripts in Exchange Online PowerShell and Security & Compliance Center PowerShell. In the past, unattended sign in required you to store the username and password in a local file or in a secret vault that's accessed at run-time. But, as we all know, storing user credentials locally is not a good security practice.
2631

27-
Because storing user credentials locally is not a safe practice, we're releasing this feature to support authentication for unattended scripts (automation) scenarios using AzureAD applications and self-signed certificates.
32+
Certificate based authentication (CBA) or app-only authentication as described in this article supports unattended script and automation scenarios by using Azure AD apps and self-signed certificates.
2833

2934
The following examples show how to use the Exchange Online PowerShell V2 module with app-only authentication:
3035

3136
> [!IMPORTANT]
32-
> 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.
37+
> In the **Connect-** commands, be sure to use an `.onmicrosoft.com` domain for the _Organization_ parameter value. Otherwise, you might encounter cryptic permission issues when you run commands in the app context.
3338
3439
- Connect using a local certificate:
3540

36-
```powershell
37-
Connect-ExchangeOnline -CertificateFilePath "C:\Users\johndoe\Desktop\automation-cert.pfx" -CertificatePassword (ConvertTo-SecureString -String "<MyPassword>" -AsPlainText -Force) -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
38-
```
41+
- **Exchange Online PowerShell**:
42+
43+
```powershell
44+
Connect-ExchangeOnline -CertificateFilePath "C:\Users\johndoe\Desktop\automation-cert.pfx" -CertificatePassword (ConvertTo-SecureString -String "<MyPassword>" -AsPlainText -Force) -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
45+
```
46+
47+
- **Security & Compliance Center PowerShell**:
48+
49+
```powershell
50+
Connect-IPPSSession -CertificateFilePath "C:\Users\johndoe\Desktop\automation-cert.pfx" -CertificatePassword (ConvertTo-SecureString -String "<MyPassword>" -AsPlainText -Force) -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
51+
```
3952
4053
- Connect using a certificate thumbprint:
4154
42-
```powershell
43-
Connect-ExchangeOnline -CertificateThumbPrint "012THISISADEMOTHUMBPRINT" -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
44-
```
55+
- **Exchange Online PowerShell**:
56+
57+
```powershell
58+
Connect-ExchangeOnline -CertificateThumbPrint "012THISISADEMOTHUMBPRINT" -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
59+
```
60+
61+
- **Security & Compliance Center PowerShell**:
62+
63+
```powershell
64+
Connect-IPPSSession -CertificateThumbPrint "012THISISADEMOTHUMBPRINT" -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
65+
```
4566
4667
When you use the _CertificateThumbPrint_ parameter, the certificate needs to be installed on the computer where you are running the command. The certificate should be installed in the user certificate store.
4768
4869
- Connect using a certificate object:
4970
50-
```powershell
51-
Connect-ExchangeOnline -Certificate <%X509Certificate2 Object%> -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
52-
```
71+
- **Exchange Online PowerShell**:
72+
73+
```powershell
74+
Connect-ExchangeOnline -Certificate <%X509Certificate2 Object%> -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
75+
```
76+
77+
- **Security & Compliance Center PowerShell**:
78+
79+
```powershell
80+
Connect-IPPSSession -Certificate <%X509Certificate2 Object%> -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
81+
```
5382
5483
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.
5584
@@ -58,7 +87,7 @@ The following examples show how to use the Exchange Online PowerShell V2 module
5887
5988
## How does it work?
6089
61-
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.
90+
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. The session's role based access control (RBAC) is configured using the directory role information that's available in the token.
6291
6392
## Set up app-only authentication
6493
@@ -68,9 +97,9 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
6897
6998
1. [Register the application in Azure AD](#step-1-register-the-application-in-azure-ad).
7099
71-
2. [Assign Exchange Online API permissions to the application](#step-2-assign-api-permissions-to-the-application).
100+
2. [Assign API permissions to the application](#step-2-assign-api-permissions-to-the-application).
72101
73-
An application object has the default permission `User.Read`. For the application object to access Exchange Online resources, it needs to have the Application permission `Exchange.ManageAsApp`.
102+
An application object has the default permission `User.Read`. For the application object to access resources, it needs to have the Application permission `Exchange.ManageAsApp`.
74103
75104
3. [Generate a self-signed certificate](#step-3-generate-a-self-signed-certificate)
76105
@@ -87,24 +116,14 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
87116
88117
5. [Assign Azure AD roles to the application](#step-5-assign-azure-ad-roles-to-the-application)
89118
90-
The application needs to have the appropriate RBAC roles assigned. Because the apps are provisioned in Azure AD, you can use any of the built-in roles. The following roles are supported:
91-
92-
- Global administrator
93-
- Compliance administrator
94-
- Security reader
95-
- Security administrator
96-
- Helpdesk administrator
97-
- Exchange administrator
98-
- Global Reader
99-
100-
> [!NOTE]
101-
> The Global administrator and Exchange administrator roles provide the necessary permissions for any Exchange-related tasks, including recipient management and protection features (anti-spam, anti-malware, etc). The Security administrator role doesn't not have the necessary permissions for these same Exchange-related tasks.
119+
The application needs to have the appropriate RBAC roles assigned. Because the apps are provisioned in Azure AD, you can use any of the supported built-in roles.
102120
103121
## Appendix
104122
105123
## Step 1: Register the application in Azure AD
106124
107-
**Note**: If you encounter problems, check the [required permissions](/azure/active-directory/develop/howto-create-service-principal-portal#required-permissions) to verify that your account can create the identity.
125+
> [!NOTE]
126+
> If you encounter problems, check the [required permissions](/azure/active-directory/develop/howto-create-service-principal-portal#required-permissions) to verify that your account can create the identity.
108127
109128
1. Open the Azure AD portal at <https://portal.azure.com/>.
110129
@@ -244,18 +263,35 @@ After you register the certificate with your application, you can use the privat
244263

245264
## Step 5: Assign Azure AD roles to the application
246265

247-
Azure AD has more than 50 admin roles available. For app-only authentication in Exchange Online, we currently support the previously mentioned roles:
266+
Azure AD has more than 50 admin roles available. The supported roles are described in the following table:
267+
268+
<br>
269+
270+
****
271+
272+
|Role|Exchange Online PowerShell|Security & Compliance Center PowerShell|
273+
|---|:---:|:---:|
274+
|Compliance Administrator|![Check mark.](media/checkmark.png)|![Check mark.](media/checkmark.png)|
275+
|Exchange Administrator<sup>\*</sup>|![Check mark.](media/checkmark.png)||
276+
|Global Administrator<sup>\*</sup>|![Check mark.](media/checkmark.png)|![Check mark.](media/checkmark.png)|
277+
|Global Reader|![Check mark.](media/checkmark.png)|![Check mark.](media/checkmark.png)|
278+
|Helpdesk Administrator|![Check mark.](media/checkmark.png)||
279+
|Security Administrator<sup>\*</sup>|![Check mark.](media/checkmark.png)|![Check mark.](media/checkmark.png)|
280+
|Security Reader|![Check mark.](media/checkmark.png)|![Check mark.](media/checkmark.png)|
281+
|
282+
283+
<sup>\*</sup> The Global Administrator and Exchange Administrator roles provide the required permissions for any task in Exchange Online PowerShell. For example:
248284

249-
- Global administrator
250-
- Compliance administrator
251-
- Security reader
252-
- Security administrator
253-
- Helpdesk administrator
254-
- Exchange administrator
255-
- Global Reader
285+
- Recipient management.
286+
- Security and protection features. For example, anti-spam, anti-malware, anti-phishing, and the associated reports.
287+
288+
The Security Administrator role does not have the necessary permissions for those same tasks.
256289

257290
For general instructions about assigning roles in Azure AD, see [View and assign administrator roles in Azure Active Directory](/azure/active-directory/roles/manage-roles-portal).
258291

292+
> [!NOTE]
293+
> The following steps are slightly different for Exchange Online PowerShell vs. Security & Compliance Center PowerShell. The steps for both environments are shown. To configure roles for both environments, repeat the steps in this section.
294+
259295
1. On the Azure AD portal at <https://portal.azure.com/>, under **Manage Azure Active Directory**, click **View**.
260296

261297
![View in the Azure AD portal under Manage Azure Active Directory.](media/exo-app-only-auth-manage-ad-view.png)
@@ -266,11 +302,23 @@ For general instructions about assigning roles in Azure AD, see [View and assign
266302

267303
3. On the **Roles and administrators** page that opens, find and select one of the supported roles by _clicking on the name of the role_ (not the check box) in the results.
268304

269-
![Find and select a supported role by clicking on the role name.](media/exo-app-only-auth-find-and-select-supported-role.png)
305+
- **Exchange Online PowerShell**:
306+
307+
![Find and select a supported Exchange Online PowerShell role by clicking on the role name.](media/exo-app-only-auth-find-and-select-supported-role.png)
308+
309+
- **Security & Compliance Center PowerShell**:
310+
311+
![Find and select a supported Security & Compliance Center PowerShell role by clicking on the role name.](media/exo-app-only-auth-find-and-select-supported-role-scc.png)
270312

271313
4. On the **Assignments** page that opens, click **Add assignments**.
272314

273-
![Select Add assignments on the role assignments page.](media/exo-app-only-auth-role-assignments-click-add-assignments.png)
315+
- **Exchange Online PowerShell**:
316+
317+
![Select Add assignments on the role assignments page for Exchange Online PowerShell.](media/exo-app-only-auth-role-assignments-click-add-assignments.png)
318+
319+
- **Security & Compliance Center PowerShell**:
320+
321+
![Select Add assignments on the role assignments page for Security & Compliance Center PowerShell.](media/exo-app-only-auth-role-assignments-click-add-assignments-scc.png)
274322

275323
5. In the **Add assignments** flyout that opens, find and select the app that you created in [Step 1](#step-1-register-the-application-in-azure-ad).
276324

@@ -280,4 +328,10 @@ For general instructions about assigning roles in Azure AD, see [View and assign
280328

281329
6. Back on the **Assignments** page, verify that the app has been assigned to the role.
282330

283-
![The role assignments page after to added the app to the role.](media/exo-app-only-auth-app-assigned-to-role.png)
331+
- **Exchange Online PowerShell**:
332+
333+
![The role assignments page after to added the app to the role for Exchange Online PowerShell.](media/exo-app-only-auth-app-assigned-to-role.png)
334+
335+
- **Security & Compliance Center PowerShell**:
336+
337+
![The role assignments page after to added the app to the role for Security & Compliance Center PowerShell.](media/exo-app-only-auth-app-assigned-to-role-scc.png)

exchange/docs-conceptual/exchange-management-shell.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ The Exchange Management Shell also provides a robust and flexible scripting plat
2121

2222
To start using the Exchange Management Shell immediately, see the [Exchange Management Shell documentation](#exchange-management-shell-documentation) section later in this article.
2323

24+
> [!NOTE]
25+
> There is no Microsoft-provided module in the PowerShell Gallery for Exchange Server PowerShell. Instead, to use PowerShell in Exchange Server, you have the following options:
26+
>
27+
> - Use the Exchange Management Shell on an Exchange server or that you've installed locally on your own computer using a **Management tools** only installation of Exchange server. For more information, see [Install the Exchange Server Management Tools](/Exchange/plan-and-deploy/post-installation-tasks/install-management-tools) and [Open the Exchange Management Shell](open-the-exchange-management-shell.md).
28+
> - Use remote PowerShell from a Windows PowerShell session. For more information, see [Connect to Exchange servers using remote PowerShell](connect-to-exchange-servers-using-remote-powershell.md).
29+
2430
## How the Exchange Management Shell works on all Exchange server roles except Edge Transport
2531

2632
Whether you use the Exchange Management Shell on a local Exchange server or on an Exchange server that's located across the country, remote PowerShell does the work.

exchange/docs-conceptual/exchange-online-powershell-v2.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Miscellaneous Exchange Online cmdlets that happen to be in the EXO V2 module are
101101
Version 2.0.6-Preview3 of the EXO V2 module is now available. This Preview version improves upon the historical capabilities of the module with the following features:
102102

103103
- 250 additional remote PowerShell cmdlets that are backed by the REST API. These REST API cmdlets don't rely on the remote PowerShell session, so PowerShell on your client computer doesn't need [Basic authentication in WinRM](#prerequisites-for-the-exo-v2-module). These REST API cmdlets also work just like their old remote PowerShell equivalent cmdlets, so you don't need to update any of your scripts.
104-
- The new _RPSSession_ switch in **Connect-ExchangeOnline** grants access to all existing remote PowerShell cmdlets. The _RPSSession_ switch requires [Basic authentication in WinRM](#prerequisites-for-the-exo-v2-module) on your client computer.
104+
- The new _UseRPSSession_ switch in **Connect-ExchangeOnline** grants access to all existing remote PowerShell cmdlets. The _UseRPSSession_ switch requires [Basic authentication in WinRM](#prerequisites-for-the-exo-v2-module) on your client computer.
105105
- A small number of existing mailbox remote PowerShell cmdlets have been updated with a new, experimental _UseCustomRoutingSwitch_ parameter. Using this switch routes the command directly to the required Mailbox server, and might improve overall performance.
106106
- When you use the _UseCustomRoutingSwitch_, you need to use the following values for identity of the mailbox:
107107
- User principal name (UPN)
@@ -223,29 +223,43 @@ The EXO V2 module is supported in the following versions of Windows:
223223
> [!NOTE]
224224
> As described [earlier in this article](#updates-for-version-206), v2.0.6 of the EXO V2 module does not require Basic authentication in WinRM for many cmdlets.
225225
>
226-
> You must temporarily enable WinRM to run the following commands. You can enable WinRM by running the command: `winrm quickconfig`.
226+
> You must temporarily enable WinRM to run the following winrm commands. You can enable WinRM by running the command: `winrm quickconfig`.
227227
228-
To verify that Basic authentication is enabled for WinRM, run this command **in a Command Prompt** (not in PowerShell):
228+
To verify that Basic authentication is enabled for WinRM, run the following command in a **Command Prompt** or **Windows PowerShell**:
229229

230-
```dos
230+
```DOS
231231
winrm get winrm/config/client/auth
232232
```
233233

234-
If you don't see the value `Basic = true`, you need to run this command **in a Command Prompt** (not in PowerShell) to enable Basic authentication for WinRM:
234+
If you don't see the value `Basic = true`, you need to run **one** of the following commands to enable Basic authentication for WinRM:
235235

236-
```dos
237-
winrm set winrm/config/client/auth @{Basic="true"}
238-
```
236+
- **In a Command Prompt**:
237+
238+
```DOS
239+
winrm set winrm/config/client/auth @{Basic="true"}
240+
```
239241
240-
**Note**: If you'd rather run the command in PowerShell, enclose this part of the command in quotation marks: `'@{Basic="true"}'`.
242+
- **In Windows PowerShell**:
241243
242-
If Basic authentication for WinRM is disabled, you'll get this error when you try to connect:
244+
```DOS
245+
winrm set winrm/config/client/auth '@{Basic="true"}'
246+
```
247+
248+
- **In Windows PowerShell to modify the registry**:
249+
250+
```PowerShell
251+
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client' -Name 'AllowBasic' -Type DWord -Value '1'
252+
```
253+
254+
If Basic authentication for WinRM is disabled, you'll get one of the following errors when you try to connect:
243255
244256
> The WinRM client cannot process the request. Basic authentication is currently disabled in the client configuration. Change the client configuration and try the request again.
245257
258+
> Create Powershell Session is failed using OAuth.
259+
246260
> [!TIP]
247261
> Having problems? Ask for help in the Exchange forums. Visit the forums at: [Exchange Online](https://go.microsoft.com/fwlink/p/?linkId=267542), or [Exchange Online Protection](https://go.microsoft.com/fwlink/p/?linkId=285351).
248-
262+
249263
### Install the EXO V2 module
250264
251265
To install the EXO V2 module for the first time, complete the following steps:

0 commit comments

Comments
 (0)