When installing Sitecore on Windows 11, you might encounter the following error:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
This issue arises due to a recent security enforcement rolled out by Microsoft. Windows 11 now requires SQL Server connections to use encrypted connections by default. Some of the PowerShell scripts used during the Sitecore installation process are not configured to handle this change, resulting in the above error.
In this blog post, we’ll dive into the root cause of the issue and walk you through the steps to resolve it.
Understanding the Root Cause
The error is triggered because the PowerShell scripts used in the Sitecore installation attempt to connect to the SQL Server without explicitly trusting the server’s SSL certificate. With the new security enforcement, connections to the SQL Server default to encryption, but without a trusted certificate, the connection fails.
This is particularly relevant when using self-signed certificates or development environments where the SQL Server’s certificate authority is not inherently trusted.
How to Fix the Error
The solution is to explicitly configure the Sitecore installation scripts to trust the SQL Server’s certificate by setting the TrustServerCertificate
variable to true
. This needs to be done in two specific JSON files used during the installation process:
- sitecore-xp0.json
- xconnect-xp0.json
Steps to Resolve
- Locate the JSON Files:
- Navigate to the folder where you extracted the Sitecore installation files.
- Open the
ConfigurationFiles
directory (or equivalent, depending on your setup). - Find the
sitecore-xp0.json
andxconnect-xp0.json
files.
- Modify the JSON Files:
- Open
sitecore-xp0.json
in a text editor (e.g., Visual Studio Code or Notepad++). - Look for
[variable('Sql.Credential')]
in the JSON structure. - Add the following key-value pair:
"TrustServerCertificate": true
- Example:
- Open
"CreateShardApplicationDatabaseServerLoginInvokeSqlCmd": { "Description": "Create Collection Shard Database Server Login.", "Type": "InvokeSqlcmd", "Params": { "ServerInstance": "[parameter('SqlServer')]", "Credential": "[variable('Sql.Credential')]", "TrustServerCertificate": true, "InputFile": "[variable('Sharding.SqlCmd.Path.CreateShardApplicationDatabaseServerLogin')]", "Variable": [ "[concat('UserName=',variable('SqlCollection.User'))]", "[concat('Password=',variable('SqlCollection.Password'))]" ] }, "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]" }, "CreateShardManagerApplicationDatabaseUserInvokeSqlCmd": { "Description": "Create Collection Shard Manager Database User.", "Type": "InvokeSqlcmd", "Params": { "ServerInstance": "[parameter('SqlServer')]", "Credential": "[variable('Sql.Credential')]", "TrustServerCertificate": true, "Database": "[variable('Sql.Database.ShardMapManager')]", "InputFile": "[variable('Sharding.SqlCmd.Path.CreateShardManagerApplicationDatabaseUser')]", "Variable": [ "[concat('UserName=',variable('SqlCollection.User'))]", "[concat('Password=',variable('SqlCollection.Password'))]" ] }, "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]" }
- Repeat the same modification for the
xconnect-xp0.json
file. - Save and Retry Installation:
- Save both JSON files after making the changes.
- Re-run the Sitecore installation PowerShell script.
Additional Notes
- Security Considerations: Setting
TrustServerCertificate
totrue
is a quick fix for development environments. However, for production environments, it’s recommended to install a certificate from a trusted Certificate Authority (CA) on the SQL Server to ensure secure and trusted communication. - Error Still Persists?: Double-check the JSON modifications and ensure the SQL Server is accessible from your machine. If issues persist, verify firewall settings and SQL Server configuration.
Conclusion
The “Certificate chain was issued by an authority that is not trusted” error during Sitecore installation is a direct result of Microsoft’s enhanced security measures in Windows 11. By updating the Sitecore configuration files to include the TrustServerCertificate
setting, you can bypass this error and complete the installation successfully.
For a smoother experience in production environments, consider implementing a properly signed SSL certificate for your SQL Server.
If you’ve encountered similar issues or have additional tips, feel free to share them in the comments below!