Skip to content

Commit 5f729eb

Browse files
committed
Update app-only-auth-powershell-v2.md
Issue #9942
1 parent b69524d commit 5f729eb

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

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

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,54 +49,57 @@ Certificate based authentication (CBA) or app-only authentication as described i
4949
The following examples show how to use the Exchange Online PowerShell module with app-only authentication:
5050

5151
> [!IMPORTANT]
52-
> 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.
52+
> In the following **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.
5353
54-
- Connect using a local certificate:
54+
- **Connect using a certificate thumbprint**:
5555

56-
- **Exchange Online PowerShell**:
56+
The certificate needs to be installed on the computer where you're running the command. The certificate should be installed in the user certificate store.
57+
58+
- <u>Exchange Online PowerShell</u>:
5759

5860
```powershell
59-
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"
61+
Connect-ExchangeOnline -CertificateThumbPrint "012THISISADEMOTHUMBPRINT" -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
6062
```
6163
62-
- **Security & Compliance PowerShell**:
64+
- <u>Security & Compliance PowerShell</u>:
6365
64-
```powershell
65-
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"
66+
```powershell
67+
Connect-IPPSSession -CertificateThumbPrint "012THISISADEMOTHUMBPRINT" -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
6668
```
6769
68-
- Connect using a certificate thumbprint:
70+
- **Connect using a certificate object**:
71+
72+
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.
6973
70-
- **Exchange Online PowerShell**:
74+
- <u>Exchange Online PowerShell</u>:
7175
7276
```powershell
73-
Connect-ExchangeOnline -CertificateThumbPrint "012THISISADEMOTHUMBPRINT" -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
77+
Connect-ExchangeOnline -Certificate <%X509Certificate2 Object%> -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
7478
```
7579
76-
- **Security & Compliance PowerShell**:
80+
- <u>Security & Compliance PowerShell</u>:
7781
7882
```powershell
79-
Connect-IPPSSession -CertificateThumbPrint "012THISISADEMOTHUMBPRINT" -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
83+
Connect-IPPSSession -Certificate <%X509Certificate2 Object%> -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
8084
```
8185
82-
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.
86+
- **Connect using a local certificate**:
8387
84-
- Connect using a certificate object:
88+
> [!NOTE]
89+
> Using a **ConvertTo-SecureString** command to store the password of the certificate locally defeats the purpose of a secure connection method for automation scenarios. Using a **Get-Credential** command to prompt you for the password of the certificate securely isn't ideal for automation scenarios. In other words, there's really no automated _and_ secure way to connect using a local certificate.
8590
86-
- **Exchange Online PowerShell**:
91+
- <u>Exchange Online PowerShell</u>:
8792
8893
```powershell
89-
Connect-ExchangeOnline -Certificate <%X509Certificate2 Object%> -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
94+
Connect-ExchangeOnline -CertificateFilePath "C:\Users\navin\Desktop\automation-cert.pfx" -CertificatePassword (Get-Credential).password -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
9095
```
9196
92-
- **Security & Compliance PowerShell**:
97+
- <u>Security & Compliance PowerShell</u>:
9398
94-
```powershell
95-
Connect-IPPSSession -Certificate <%X509Certificate2 Object%> -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
99+
```powershell
100+
Connect-IPPSSession -CertificateFilePath "C:\Users\navin\Desktop\automation-cert.pfx" -CertificatePassword (Get-Credential).password -AppID "36ee4c6c-0812-40a2-b820-b22ebd02bce3" -Organization "contosoelectronics.onmicrosoft.com"
96101
```
97102
98-
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.
99-
100103
> [!TIP]
101104
> App-only authentication does not support delegation. Unattended scripting in delegation scenarios is supported with the Secure App Model. For more information, go [here](/powershell/partnercenter/multi-factor-auth#exchange).
102105

0 commit comments

Comments
 (0)