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/app-only-auth-powershell-v2.md
+26-28Lines changed: 26 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: App-only authentication in Exchange Online PowerShell and Security & Comp
3
3
ms.author: chrisda
4
4
author: chrisda
5
5
manager: dansimp
6
-
ms.date: 5/3/2023
6
+
ms.date: 6/21/2023
7
7
ms.audience: Admin
8
8
audience: Admin
9
9
ms.topic: article
@@ -14,12 +14,12 @@ ms.collection: Strat_EX_Admin
14
14
ms.custom:
15
15
ms.assetid:
16
16
search.appverid: MET150
17
-
description: "Learn about using the Exchange Online PowerShell V2 module and V3 module in scripts and other long-running tasks with modern authentication and app-only authentication (also known a certificate based authentication or CBA)."
17
+
description: "Learn how to configure app-only authentication (also known as certificate based authentication or CBA) using the Exchange Online PowerShell V3 module in scripts and other long-running tasks."
18
18
---
19
19
20
20
# App-only authentication for unattended scripts in Exchange Online PowerShell and Security & Compliance PowerShell
21
21
22
-
Auditing and reporting scenarios in Microsoft 365 often involve unattended scripts in Exchange Online PowerShell and Security & Compliance 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.
22
+
Auditing and reporting scenarios in Microsoft 365 often involve unattended scripts in Exchange Online PowerShell and Security & Compliance 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 isn't a good security practice.
23
23
24
24
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.
25
25
@@ -49,7 +49,7 @@ Certificate based authentication (CBA) or app-only authentication as described i
49
49
50
50
## How does it work?
51
51
52
-
The Exchange Online PowerShell 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.
52
+
The Exchange Online PowerShell 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.
53
53
54
54
## Connection examples
55
55
@@ -60,9 +60,7 @@ The following examples show how to use the Exchange Online PowerShell module wit
60
60
>
61
61
> The following connection commands have many of the same options available as described in [Connect to Exchange Online PowerShell](connect-to-exchange-online-powershell.md) and [Connect to Security & Compliance PowerShell](connect-to-scc-powershell.md). For example:
62
62
>
63
-
> - You can use REST API cmdlets or original remote PowerShell cmdlets. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
64
-
>
65
-
> Remote PowerShell support in Exchange Online PowerShell will be deprecated. For more information, see [Announcing Deprecation of Remote PowerShell (RPS) Protocol in Exchange Online PowerShell](https://aka.ms/RPSDeprecation).
63
+
> Remote PowerShell support in Exchange Online PowerShell will be deprecated. For more information, see [Announcing Deprecation of Remote PowerShell (RPS) Protocol in Exchange Online PowerShell](https://aka.ms/RPSDeprecation).
66
64
>
67
65
> - Microsoft 365 GCC High or Microsoft 365 DoD environments require the following additional parameters and values:
68
66
> -**Connect-ExchangeOnline in GCC High**: `-ExchangeEnvironmentName O365USGovGCCHigh`.
@@ -93,7 +91,7 @@ The following examples show how to use the Exchange Online PowerShell module wit
93
91
94
92
- **Connect using a certificate object**:
95
93
96
-
The certificate does not need to be installed on the computer where you're running the command. You can store the certificate object remotely. The certificate is fetched when the script is run.
94
+
The certificate doesn't need to be installed on the computer where you're running the command. You can store the certificate object remotely. The certificate is fetched when the script is run.
97
95
98
96
- <u>Exchange Online PowerShell</u>:
99
97
@@ -126,7 +124,7 @@ The following examples show how to use the Exchange Online PowerShell module wit
126
124
127
125
## Set up app-only authentication
128
126
129
-
An initial onboarding is required for authentication using application objects. Application and service principal are used interchangeably, but an application is like a class object while a service principal is like an instance of the class. You can learn more about this at [Application and service principal objects in Azure Active Directory](/azure/active-directory/develop/app-objects-and-service-principals).
127
+
An initial onboarding is required for authentication using application objects. Application and service principal are used interchangeably, but an application is like a class object while a service principal is like an instance of the class. For more information, see [Application and service principal objects in Azure Active Directory](/azure/active-directory/develop/app-objects-and-service-principals).
130
128
131
129
For a detailed visual flow about creating applications in Azure AD, see <https://aka.ms/azuread-app>.
132
130
@@ -140,9 +138,9 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
140
138
141
139
- For app-only authentication in Azure AD, you typically use a certificate to request access. Anyone who has the certificate and its private key can use the app, and the permissions granted to the app.
142
140
143
-
- Create and configure a self-signed X.509 certificate, which will be used to authenticate your Application against Azure AD, while requesting the app-only access token.
141
+
- Create and configure a self-signed X.509 certificate, which is used to authenticate your Application against Azure AD, while requesting the app-only access token.
144
142
145
-
- This is similar to generating a password for user accounts. The certificate can be self-signed as well. See the [Appendix](#step-3-generate-a-self-signed-certificate) section later in this article for instructions for generating certificates in PowerShell.
143
+
- This procedure is similar to generating a password for user accounts. The certificate can be self-signed as well. See the [Appendix](#step-3-generate-a-self-signed-certificate) section later in this article for instructions for generating certificates in PowerShell.
146
144
147
145
> [!NOTE]
148
146
> Cryptography: Next Generation (CNG) certificates are not supported for app-only authentication with Exchange. CNG certificates are created by default in modern Windows versions. You must use a certificate from a CSP key provider. The [Appendix](#step-3-generate-a-self-signed-certificate) section covers two supported methods to create a CSP certificate.
@@ -166,7 +164,7 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
166
164
167
165
Or, to go directly to the **App registrations** page, use <https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade>.
168
166
169
-
3. On the **App registrations** page, click **New registration**.
167
+
3. On the **App registrations** page, select **New registration**.
170
168
171
169

172
170
@@ -186,7 +184,7 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
186
184
187
185

188
186
189
-
When you're finished, click **Register**.
187
+
When you're finished on the **App registrations** page, select **Register**.
190
188
191
189
4. Leave the app page that you return to open. You'll use it in the next step.
192
190
@@ -234,9 +232,9 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
234
232
> ],
235
233
> ```
236
234
237
-
When you're finished, click **Save**.
235
+
When you're finished on the **Manifest** page, select **Save**.
238
236
239
-
3. Still on the **Manifest** page, under **Management**, select **API permissions**.
237
+
3. Still on the **Manifest** page, select **API permissions** under **Management**.
240
238
241
239

242
240
@@ -251,13 +249,13 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
251
249
252
250

253
251
254
-
Select **Grant admin consent for \<Organization\>**, read the confirmation dialog that opens, and then click **Yes**.
252
+
Select **Grant admin consent for \<Organization\>**, read the confirmation dialog that opens, and then select **Yes**.
255
253
256
254
The **Status** value should now be **Granted for \<Organization\>**.
4. Close the current **API permissions** page (not the browser tab) to return to the **App registrations** page. You'll use it in an upcoming step.
258
+
4. Close the current **API permissions** page (not the browser tab) to return to the **App registrations** page. You use the **App registrations** page in an upcoming step.
261
259
262
260
### Step 3: Generate a self-signed certificate
263
261
@@ -296,15 +294,15 @@ After you register the certificate with your application, you can use the privat
296
294
297
295

298
296
299
-
3. On the **Certificates & secrets** page that opens, click**Upload certificate**.
297
+
3. On the **Certificates & secrets** page that opens, select**Upload certificate**.
300
298
301
299

302
300
303
301
In the dialog that opens, browse to the self-signed certificate (`.cer` file) that you created in [Step 3](#step-3-generate-a-self-signed-certificate).
304
302
305
-

303
+

306
304
307
-
When you're finished, click**Add**.
305
+
When you're finished, select**Add**.
308
306
309
307
The certificate is now shown in the **Certificates** section.
310
308
@@ -328,8 +326,8 @@ For more information about the URL syntax, see [Request the permissions from a d
328
326
329
327
You have two options:
330
328
331
-
-**Assign Azure AD roles to the application**: This method is supported in Exchange Online PowerShell and Security & Compliance PowerShell.
332
-
-**Assign custom Exchange Online role groups to the application using service principals**: This method is supported only when you connect in [REST API mode](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
329
+
-**Assign Azure AD roles to the application**
330
+
-**Assign custom role groups to the application using service principals**: This method is supported only when you connect to Exchange Online PowerShell or Security & Compliance PowerShell in [REST API mode](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module). Security & Compliance PowerShell supports REST API mode in v3.2.0 or later.
333
331
334
332
> [!NOTE]
335
333
> You can also combine both methods to assign permissions. For example, you can use Azure AD roles for the "Exchange Recipient Administrator" role and also assign your custom RBAC role to extend the permissions.
@@ -379,7 +377,7 @@ For general instructions about assigning roles in Azure AD, see [View and assign
379
377
380
378

381
379
382
-
3. On the **Assignments** page that opens, click**Add assignments**.
380
+
3. On the **Assignments** page that opens, select**Add assignments**.
383
381
384
382
-**Exchange Online PowerShell**:
385
383
@@ -393,7 +391,7 @@ For general instructions about assigning roles in Azure AD, see [View and assign
393
391
394
392

395
393
396
-
When you're finished, click**Add**.
394
+
When you're finished in the **Add assignments** flyout, select**Add**.
397
395
398
396
5. Back on the **Assignments** page, verify that the role has been assigned to the app.
399
397
@@ -405,14 +403,14 @@ For general instructions about assigning roles in Azure AD, see [View and assign
405
403
406
404

407
405
408
-
#### Assign custom Exchange Online role groups to the application using service principals
406
+
#### Assign custom role groups to the application using service principals
409
407
410
408
> [!NOTE]
411
-
> You need to connect to Exchange Online PowerShell or Security & Compliance PowerShell _before_ completing steps to create a new service principal. Creating a new service principal without connecting to PowerShell won't work (your Azure App ID and Object ID is needed to create the new service principal).
409
+
> You need to connect to Exchange Online PowerShell or Security & Compliance PowerShell _before_ completing steps to create a new service principal. Creating a new service principal without connecting to PowerShell won't work (your Azure App ID and Object ID are needed to create the new service principal).
412
410
>
413
-
> This method is supported only when you connect in [REST API mode](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
411
+
> This method is supported only when you connect to Exchange Online PowerShell or Security & Compliance PowerShell in [REST API mode](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module). Security & Compliance PowerShell supports REST API mode in v3.2.0 or later.
414
412
415
-
For information about creating custom role groups, see [Create role groups](/exchange/permissions-exo/role-groups#create-role-groups). The custom role group that you assign to the application can contain any combination of built-in and custom roles.
413
+
For information about creating custom role groups, see [Create role groups in Exchange Online](/exchange/permissions-exo/role-groups#create-role-groups) and [Create Email & collaboration role groups in the Microsoft 365 Defender portal](/microsoft-365/security/office-365-security/mdo-portal-permissions#create-email--collaboration-role-groups-in-the-microsoft-365-defender-portal). The custom role group that you assign to the application can contain any combination of built-in and custom roles.
416
414
417
415
To assign custom role groups to the application using service principals, do the following steps:
-\<ResourceGroupName\> is the name of the resource group that's already assigned to the Automation account.
270
270
-\<AutomationAccountName\> is the name of the Automation account.
271
-
-\<LatestModuleVersion\> is the current version of the ExchangeOnlineManagement module. To see the latest GA (non-Preview) version of the module, run the following command in Windows PowerShell: `Find-Module ExchangeOnlineManagement`. To see the latest Preview release, run the following command: `Find-Module ExchangeOnlineManagement -AllowPrerelease`.
271
+
-\<LatestModuleVersion\> is the current version of the ExchangeOnlineManagement module. To see the latest General Availability (GA; non-Preview) version of the module, run the following command in Windows PowerShell: `Find-Module ExchangeOnlineManagement`. To see the latest Preview release, run the following command: `Find-Module ExchangeOnlineManagement -AllowPrerelease`.
272
272
- Currently, the PowerShell procedures don't give you a choice for the runtime version (it's 5.1).
Copy file name to clipboardExpand all lines: exchange/docs-conceptual/connect-to-scc-powershell.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Connect to Security & Compliance PowerShell
3
3
author: chrisda
4
4
manager: dansimp
5
-
ms.date:
5
+
ms.date:6/21/2023
6
6
ms.audience: Admin
7
7
audience: Admin
8
8
ms.topic: article
@@ -35,7 +35,7 @@ To use the older Exchange Online Remote PowerShell Module (the V1 module) to con
35
35
36
36
> [!NOTE]
37
37
>
38
-
> If you're using version 3.2.0-Preview4 or later of the module, and you don't use the _UseRPSSession_ switch in the **Connect-IPPSSession** command, you have access to REST API cmdlets _only_. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
38
+
> If you're using version 3.2.0 or later of the module, and you don't use the _UseRPSSession_ switch in the **Connect-IPPSSession** command, you have access to REST API cmdlets _only_. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
39
39
40
40
- 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 the Microsoft 365 Defender portal](/microsoft-365/security/office-365-security/mdo-portal-permissions) and [Permissions in the Microsoft Purview compliance portal](/microsoft-365/compliance/microsoft-365-compliance-center-permissions).
41
41
@@ -65,7 +65,7 @@ For detailed syntax and parameter information, see [Connect-IPPSSession](/powers
65
65
66
66
-_\<UPN\>_ is your account in user principal name format (for example, `[email protected]`).
67
67
68
-
- In v3.2.0-Preview4 or later of the module, if you don't use the _UseRPSSession_ switch in the **Connect-IPPSSession** command, you connect in REST API mode. To connect in remote PowerShell mode, use the _UseRPSSession_ switch. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
68
+
- In v3.2.0 or later of the module, if you don't use the _UseRPSSession_ switch in the **Connect-IPPSSession** command, you connect in REST API mode. To connect in remote PowerShell mode, use the _UseRPSSession_ switch. For more information, see [Updates for the EXO V3 module)](exchange-online-powershell-v2.md#updates-for-the-exo-v3-module).
69
69
70
70
- The required _ConnectionUri_ and _AzureADAuthorizationEndpointUri_ values depend on the nature of your Microsoft 365 organization. Common values are described in the following table:
0 commit comments