May 3, 2019
I started working on a development server and besides being slower than normal, the Sitecore log files were full of XConnect errors. Moreover, when browsing the various Sitecore websites on the device, Chrome complained that the site certificates were invalid. I started investigating and found that the site certificates didn't match the domains. This appears to be a common issue with Sitecore 9. One solution is to start fresh with a new installation. However, I found it easier to update the certificates in place and preserve the configuration the previous developers and consultants left. You could use also use these steps to refresh your certificates when they expire.
Some examples of the exceptions I found in the logs were:
Exception: System.Net.WebException
Message: The request was aborted: Could not create SSL/TLS secure channel.
Exception: Sitecore.XConnect.XdbCollectionUnavailableException
Message: The HTTP response was not successful: Forbidden
These are the references I used to research these issues:
Initially, I attempted to fix the issues with the suggestions in these posts. However, I couldn't get the sites to work and the sheer number of Sitecore related certificates on the server (24) made me think the previous developers had tried similar approaches. So instead, this is how I reset certificates for Sitecore 9.0.1 and Sitecore Commerce.
Delete the existing Sitecore website certificates so they don't conflict and aren't confusing when binding sites in later steps.
I created a simple PowerShell script you can use (at the end of this post). Make sure you adjust the script with all of the hostnames you are using (Commerce, xConnect, and the website reference each other so check the configs).
The website app pools need read access to the certificates for verification.
If you followed my script, three website certificates were created based off a singular root, Sitecore Development Root. In order to get applications to trust these certificates, we need to add this root certificate to the trusted root store. The following steps export the root certificate and then add it to the store.
Our certificates are ready to be used. Follow these steps to get IIS to use them on the appropriate sites.
The last step is to update the configuration settings so the various Sitecore applications trust the certificates. This is where you will use the thumbprints that were generated from the PowerShell script. If you no longer have them, you can still look them up on the certificate.
$rootparams = @@{DnsName = "Sitecore Development Root" KeyExportPolicy = 'Exportable' NotAfter = (Get - Date).AddYears(10) CertStoreLocation = 'Cert:\LocalMachine\My' KeyUsage = 'CertSign','CRLSign'}$rootCA = New-SelfSignedCertificate @@rootparams $webparams = @@{DnsName = "YOUR.WEBSITE.DOMAIN(S)" FriendlyName = "Sitecore Website" Signer = $rootCA KeyExportPolicy = 'Exportable' NotAfter = (Get - date).AddYears(10) CertStoreLocation = 'Cert:\LocalMachine\My'}$webCert = New-SelfSignedCertificate @@webparams Write-Host -Object "Website: $($webCert.Thumbnail)" $commerceparams = @@{DnsName = "localhost" FriendlyName = "Sitecore Commerce and Identity Server" Signer = $rootCA KeyExportPolicy = 'Exportable' KeySpec = 'Signature' NotAfter = (Get - date).AddYears(10) CertStoreLocation = 'Cert:\LocalMachine\My'}$commerceCert = New-SelfSignedCertificate @@commerceparams Write-Host -Object "Commerce: $($commerceCert.Thumbnail)" $connectparams = @@{DnsName = "sitecore9.xconnect" FriendlyName = "Sitecore xConnect" Signer = $rootCA KeyExportPolicy = 'Exportable' NotAfter = (Get - date).AddYears(10) CertStoreLocation = 'Cert:\LocalMachine\My'}$connectCert = New-SelfSignedCertificate @@connectparams Write-Host -Object "xConnect: $($connectCert.Thumbnail)"