web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Configure CRM OnPrem with Sharepoint Online Certificate Error

(0) ShareShare
ReportReport
Posted on by 321

Hello all,

I'm attempting to configure our On-Premise CRM 2016 to work with Sharepoint Online via server-based authentication. I'm following the steps in https://technet.microsoft.com/en-us/library/mt171421.aspx and running into some issues.

Specifically, step 2 is to "Prepare the certificate" using the powershell commands:

$CertificateScriptWithCommand = “.\CertificateReconfiguration.ps1 -certificateFile c:\Personalcertfile.pfx 
-password personal_certfile_password -updateCrm -certificateType S2STokenIssuer 
-serviceAccount contoso\CRMAsyncService -storeFindType FindBySubjectDistinguishedName”

Invoke-Expression -command $CertificateScriptWithCommand


I've exported our certificate (wildcard, being used for remote gateway etc so I know it works) via the Certificates MMC with a private key, and used the password in the command above (I'm listing the generic command for obvious reason). 

When I run the Invoke-Expression I get the message:

    "Certificate private key is not found"

I've tried exporting the certificate on a different server, tried changing the password, none seems to get around this error. A search here as well as on Google doesn't seem to find anything, so I must be doing something glaringly wrong.

Any ideas are greatly appreciated.


Thanks

Garrett

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    6,804 on at

    Hi GTW,

    How did you create your self-signed certificate? In the past I found that not all self-signed certificates work.  The method I use is using Windows SDK - MakeCert command.

    Download Windows SDK.

    https://developer.microsoft.com/en-us/windows/downloads/windows-8-sdk

    Use below command to generate the certificate.

    makecert -r -pe -e 12/23/2017 -eku 1.3.6.1.5.5.7.3.1 -ss My -n CN=*.xxxxxx.xxxx -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -len 2048

    Also make sure to include Private Key and all extended properties when exporting.

    Hope this helps.

    Cheers,

    Nadeeja

    If the answer solves your problem, please mark as Verified. Thanks.

    My Blog: http://dyn365apps.com/ - Follow me on Twitter: https://twitter.com/dyn365apps

    LinkedIn: https://www.linkedin.com/in/nadeeja

  • GTW Profile Picture
    321 on at

    Hello and thanks for the suggestion.

    In this case, I am using a publicly-purchased SSL wildcard certificate and not a self-signed. Does this make a difference? I would assume the "official" certificate should work.

    I don't think I selected to export all extended properties, so I will try that with this cert.

    If there is a reason we'd need to use a self-signed, I can try that as well.

    Thanks,

    Garrett

  • GTW Profile Picture
    321 on at

    I tried re-exporting the certificate with all extended properties and got the same result. I will try your suggestion on the self-signed.

  • Community Member Profile Picture
    on at

    Hi, 

    Check this below:

    Private key not found” error message returned when you run the CertificateReconfiguration.ps1 Windows PowerShell script

    Applies to: Microsoft Dynamics 365 (online) with Microsoft SharePoint on-premises, Microsoft Dynamics 365 on-premises with SharePoint Online, Microsoft Dynamics 365 on-premises with SharePoint on-premises

    This issue can occur when there are two self-signed certificates located in the local certificate store that have the same subject name.

    Notice that this issue should only occur when you use a self-signed certificate. Self-signed certificates should not be used in production environments.

    To resolve this issue, remove the certificates with the same subject name that you don’t need using the Certificate Manager MMC snap-in and note the following.

  • Knut Eivind Handeland Profile Picture
    10 on at

    Hi, got the same error, but found out that the reason was that I had forgot to start PowerShell with Administrative Rights.

    Right-click the PowerShell icon and select Run as administrator

  • Community Member Profile Picture
    on at

    I have the exact same issue, did you resolve this?

  • Community Member Profile Picture
    on at

    I'm having the same issue as well.  I'm using a certificate issued by my domain CA.  Any resolution yet?

  • Community Member Profile Picture
    on at

    docs.microsoft.com/.../troubleshooting-server-based-authentication

    There is a section: "Private key not found” error message returned when you run the CertificateReconfiguration.ps1 Windows PowerShell script"

  • Suggested answer
    Rahul-Jha Profile Picture
    5 on at

    You need to have private key generated in legacy key.

    use the below CSP when generating CSR or while selecting CSP for the private key.

    Microsoft RSA SChannel Cryptographic Provider

    Thanks,
    Rahul

  • Suggested answer
    d3h563 Profile Picture
    5 on at

    Change Line

    CertUtil -f -p $password -importPFX $certificateFile | Out-Null

    into

    CertUtil -csp "Microsoft Enhanced RSA and AES Cryptographic Provider" -f -p $password -importPFX $certificateFile | Out-Null

    This would ensure imported Certificate uses CSP instead of KSP which seems to be required.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans