- 2023.1
- Designer
- [en] Data Sources
- [en] Microsoft SharePoint
- [en] Create Certificate for SharePoint List App-Only Authentication
[en] Create Certificate for SharePoint List App-Only Authentication
[en] To enable SharePoint List app-only authentication, you need to create a certificate, upload it to Azure portal, and obtain a private key.
[en] To create a certificate…
[en] Create an empty folder on your computer.
[en] Create a text file in the folder.
[en] Copy the PowerShell script from the Granting access via Azure AD App-Only page and paste it into the text file.
[en] Rename the text file to:
Create-SelfSignedCertificate.ps1
[en] Run Windows PowerShell in the folder.
[en] Go to the directory which contains the text file. Otherwise, the next step will fail.
[en] Copy the command:
.\Create-SelfSignedCertificate.ps1 -CommonName "myCertificate" -StartDate 2022-09-25 -EndDate 2023-10-25
[en] The CommonName value in quotes is the name of the certificate which we’re creating. Enter a unique name for this value. Change the StartDate to the current date and the EndDate to a date of your choice.
[en] Paste the copied command with your changes to Windows PowerShell and then press Enter.
[en] Windows PowerShell will prompt Enter the password to protect Private Key.
[en] Make sure you always remember the password as it is very important in later steps.
[en] Windows PowerShell creates 2 files: MyCertificate.pfx and MyCertificate.cer.
[en] To upload your certificate to Azure portal…
[en] Sign in to Azure Portal and register a new application with these parameters:
[en] Name: Name of you choice.
[en] Supported account types: Accounts in this organizational directory only (Account name only - Single tenant).
[en] Go to API Permissions > Add permission > Request API permissions > SharePoint.
[en] Select Application permissions and then add your required permissions.
[en] Select Grant admin consent and then select Yes.
[en] When you complete the previous steps, go to Certificates & Secrets. Don’t add Client Secrets in the app as it interferes with the certificate-based authentication flow.
[en] Select Upload Certificate and then upload your CER certificate from your computer. After the upload finishes, select Add.
[en] Go to Manifest, find KeyCredentials and then copy the customKeyIdentifier as the Thumbprint. You will use this later. You've now registered the app and linked the certificate.
[en] To obtain a private key, convert the PFX file to a PEM file using OpenSSL.
[en] Run the Command Prompt.
[en] Go to the folder with your PFX file and run this command:
openssl pkcs12 -in MyCertificate.pfx -out MyCertificate.pem -nodes
[en] Enter the PFX password which you used in step 8 of the certificate creation process.
[en] Open the PEM file in Notepad and copy the private key including
-----BEGIN PRIVATE KEY-----
[en] to
-----END PRIVATE KEY-----
[en] To finish the setup...
[en] Copy the ClientID and TentantID from the newly registered app in the Azure portal.
[en] Once you have all of these 4 credentials, you can sign in with SharePoint List Service Principal authentication.
[en] Client ID
[en] Tenant ID
[en] Thumbprint
[en] Private key