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-19Lines changed: 26 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,6 @@ ms.collection: Strat_EX_Admin
13
13
ms.custom:
14
14
ms.assetid:
15
15
search.appverid: MET150
16
-
ROBOTS: NOINDEX, NOFOLLOW
17
16
description: "Learn about using the Exchange Online V2 module in scripts and other long-running tasks with modern authentication and app-only authentication."
18
17
---
19
18
@@ -41,7 +40,7 @@ The following examples show how to use the Exchange Online PowerShell V2 module
41
40
```
42
41
43
42
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.
44
-
43
+
45
44
- Connect using a certificate object:
46
45
47
46
```powershell
@@ -50,11 +49,17 @@ The following examples show how to use the Exchange Online PowerShell V2 module
50
49
51
50
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.
52
51
52
+
> [!TIP]
53
+
>
54
+
> - 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.
55
+
>
56
+
> - App-only authentication does not support delegation. Unattended scripting in delegation scenarios is supported with the Secure App Model. For more information, go [here](https://docs.microsoft.com/powershell/partnercenter/multi-factor-auth#exchange).
57
+
53
58
## How does it work?
54
59
55
60
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.
56
61
57
-
## Setup app-only authentication
62
+
## Set up app-only authentication
58
63
59
64
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](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals).
60
65
@@ -73,7 +78,7 @@ For a detailed visual flow about creating applications in Azure AD, see <https:/
73
78
- 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.
74
79
75
80
- 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 topic for instructions for generating certificates in PowerShell.
76
-
81
+
77
82
> [!NOTE]
78
83
> 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.
79
84
@@ -121,25 +126,27 @@ If you encounter problems, check the [required permssions](https://docs.microsof
121
126
122
127
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).
123
128
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
-

131
-
132
-
4. In the flyout that appears, click **Application permissions**.
129
+
1. Select **Manifest** in the left-hand navigation under **Manage**.
133
130
134
-
5. In the **Select permissions** section that appears on the page, expand **Exchange** and select **Exchange.ManageAsApp**
131
+
2. Locate the `requiredResourceAccess` property in the manifest, and add the following inside the square brackets (`[]`):
6. Back on the **Configured permissions**page that appears, click **Grant admin consent for \<tenant name\>**, and select **Yes**in the dialog that appears.
147
+
4. Select **API permissions**under **Manage**. Confirm that the **Exchange.ManageAsApp**permission is listed.
141
148
142
-
7. Close the flyout when you're finished.
149
+
5. Select **Grant admin consent for org** and accept the consent dialog.
143
150
144
151
## Step 3: Generate a self-signed certificate
145
152
@@ -149,7 +156,7 @@ Create a self-signed x.509 certificate using one of the following methods:
Copy file name to clipboardExpand all lines: exchange/docs-conceptual/basic-auth-connect-to-eop-powershell.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ The following introductory video shows you how to connect to and use Exchange On
61
61
**Note**: You must temporarily enable WinRM to run the following commands. You can enable it by running the command: `winrm quickconfig`.
62
62
63
63
To verify that Basic authentication is enabled for WinRM, run this command **in a Command Prompt** (not in Windows PowerShell):
64
-
64
+
65
65
```dos
66
66
winrm get winrm/config/client/auth
67
67
```
@@ -124,7 +124,7 @@ If you receive errors, check the following requirements:
124
124
125
125
- 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.
126
126
127
-
- To help prevent denial-of-service (DoS) attacks, you're limited to three open remote PowerShell connections to your Exchange Online Protection organization.
127
+
- To help prevent denial-of-service (DoS) attacks, you're limited to five open remote PowerShell connections to Exchange Online Protection.
128
128
129
129
- 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.
Copy file name to clipboardExpand all lines: exchange/docs-conceptual/basic-auth-connect-to-exo-powershell.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ The following introductory video shows you how to connect to and use Exchange On
64
64
**Note**: You must temporarily enable WinRM to run the following commands. You can enable it by running the command: `winrm quickconfig`.
65
65
66
66
To verify that Basic authentication is enabled for WinRM, run this command **in a Command Prompt** (not in Windows PowerShell):
67
-
67
+
68
68
```dos
69
69
winrm get winrm/config/client/auth
70
70
```
@@ -134,7 +134,7 @@ If you receive errors, check the following requirements:
134
134
135
135
- 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.
136
136
137
-
- To help prevent denial-of-service (DoS) attacks, you're limited to three open remote PowerShell connections to your Exchange Online organization.
137
+
- To help prevent denial-of-service (DoS) attacks, you're limited to five open remote PowerShell connections to Exchange Online.
138
138
139
139
- The account you use to connect to Exchange Online 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).
Copy file name to clipboardExpand all lines: exchange/docs-conceptual/basic-auth-connect-to-scc-powershell.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,15 +23,15 @@ Security & Compliance Center PowerShell allows you to manage your Security & Com
23
23
24
24
> [!NOTE]
25
25
> The procedures in this topic won't work if:
26
-
>
26
+
>
27
27
> - Your account uses multi-factor authentication (MFA).
28
-
>
28
+
>
29
29
> - Your organization uses federated authentication.
30
-
>
30
+
>
31
31
> - A location condition in an Azure Active Directory conditional access policy restricts your access to trusted IPs.
32
-
>
32
+
>
33
33
> In these scenarios, you need to download and use the Exchange Online PowerShell V2 module (EXO V2 module) to connect to Security & Compliance Center PowerShell. For instructions, see [Connect to Security & Compliance Center PowerShell using the EXO V2 module](connect-to-scc-powershell.md).
34
-
>
34
+
>
35
35
> Some features in the Security & Compliance Center (for example, mailbox archiving) link to existing functionality in Exchange Online. To use PowerShell with these features, you need to connect to Exchange Online PowerShell instead of Security & Compliance Center PowerShell. For instructions, see [Connect to Exchange Online PowerShell](connect-to-exchange-online-powershell.md).
36
36
37
37
## What do you need to know before you begin?
@@ -133,7 +133,7 @@ If you receive errors, check the following requirements:
133
133
134
134
- Verify that your account has permission to access the Security & Compliance Center. For details, see [Give users access to the Security & Compliance Center](https://docs.microsoft.com/microsoft-365/security/office-365-security/grant-access-to-the-security-and-compliance-center).
135
135
136
-
- To help prevent denial-of-service (DoS) attacks, you're limited to three open remote PowerShell connections to the Security & Compliance Center.
136
+
- To help prevent denial-of-service (DoS) attacks, you're limited to five open remote PowerShell connections to the Security & Compliance Center.
137
137
138
138
- 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.
0 commit comments