Skip to content

Commit 8f3385f

Browse files
authored
Merge pull request MicrosoftDocs#6728 from leewisestamp/patch-2
Update app-only-auth-powershell-v2.md
2 parents 37841fc + c1f8e1b commit 8f3385f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,18 @@ You need to assign the API permission `Exchange.ManageAsApp` so the application
145145

146146
Create a self-signed x.509 certificate using one of the following methods:
147147

148-
- (Recommended) Use the [New-SelfSignedCertificate](https://docs.microsoft.com/powershell/module/pkiclient/new-selfsignedcertificate) and [Export-PfxCertificate](https://docs.microsoft.com/powershell/module/pkiclient/export-pfxcertificate) cmdlets to request a self-signed certificate and export it to PFX.
148+
- (Recommended) Use the [New-SelfSignedCertificate](https://docs.microsoft.com/powershell/module/pkiclient/new-selfsignedcertificate), [Export-Certificate](https://docs.microsoft.com/powershell/module/pkiclient/export-certificate) and [Export-PfxCertificate](https://docs.microsoft.com/powershell/module/pkiclient/export-pfxcertificate) cmdlets to request a self-signed certificate and export it to `.cer` and `.pfx`.
149+
150+
```powershell
151+
# Create certificate
152+
New-SelfSignedCertificate -DnsName "example.com" -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(1)
153+
154+
# Export certificate to .pfx file
155+
Get-ChildItem -Path Cert:\localMachine\my\1DC696D8BE9E656D1F9ED576931B44EC650CF0F8 | Export-PfxCertificate -FilePath mycert.pfx -Password $(ConvertTo-SecureString -String "1234" -Force -AsPlainText)
156+
157+
# Export certificate to .cer file
158+
Get-ChildItem -Path Cert:\localMachine\my\1DC696D8BE9E656D1F9ED576931B44EC650CF0F8 | Export-Certificate -FilePath mycert.cer
159+
```
149160

150161
- Use the [Create-SelfSignedCertificate script](https://github.com/SharePoint/PnP-Partner-Pack/blob/master/scripts/Create-SelfSignedCertificate.ps1). Note that this script generates SHA1 certificates.
151162

@@ -155,7 +166,7 @@ Create a self-signed x.509 certificate using one of the following methods:
155166

156167
## Step 4: Attach the certificate to the Azure AD application
157168

158-
After you register the certificate with your application, you can use the public key (.pfx file) or the thumbprint for authentication.
169+
After you register the certificate with your application, you can use the public key (`.pfx` file) or the thumbprint for authentication.
159170

160171
1. In the Azure AD portal under **Manage Azure Active Directory**, click **View**.
161172

@@ -169,7 +180,7 @@ After you register the certificate with your application, you can use the public
169180

170181
![Click Upload certificate](media/app-only-auth-upload-cert.png)
171182

172-
6. In the dialog that appears, browse to the self-signed certificate you created in the previous Step, and then click **Add**.
183+
6. In the dialog that appears, browse to the self-signed certificate (`.cer` file) you created in the previous step, and then click **Add**.
173184

174185
## Step 5: Assign a role to the application
175186

0 commit comments

Comments
 (0)