I was having trouble while setting up a local instance of Sitecore Docker instance using Sitecore Demo Edge GitHub Repo for Sitecore version 10.3. All containers were up and running normally but when I was trying to login using configured credentials in the .env file , it said "invalid username or password".
However, there are steps you can take to troubleshoot and resolve this issue. In this article, we will guide you through the process of troubleshooting and resolving the Sitecore Invalid username or password error when trying to log in to Sitecore Docker setup.
Before we begin, it's important to note that the steps mentioned here assume you have administrative access to the Sitecore environment. Let's get started!
However, there are steps you can take to troubleshoot and resolve this issue. In this article, we will guide you through the process of troubleshooting and resolving the Sitecore Invalid username or password error when trying to log in to Sitecore Docker setup.
Before we begin, it's important to note that the steps mentioned here assume you have administrative access to the Sitecore environment. Let's get started!
To verify the Sitecore Authentication error which prevent user to login into Sitecore Docker setup we should validate following details
- Step 1: Verify the Sitecore Admin username and password
Double-check the username and password you are using to log in to Sitecore. Ensure that you have entered the correct credentials, including the proper capitalization, special characters, and any leading or trailing spaces. Sitecore usernames and passwords are case-sensitive, so make sure you are using the exact combination of uppercase and lowercase letters which are generally defined in the .env file in the Sitecore Docker setup.
- Step 2: Validate the Sitecore Admin user in SQL database
To check the Sitecore Admin user, you should have the SQL database credentials and for this you can check the Sitecore Docker .env file, and look for SQL_SA_LOGIN and SQL_SA_PASSWORD environment variables.
Use these credentials and host port number mentioned in the MSSQL service in Docker compose file (e.g, localhost,14330) or check the article Querying your Sitecore SQL container to login into Sitecore SQL container databases.
Verify the the admin user superuser or default admin user admin in [Sitecore.Core].[dbo].[aspnet_Users] table
If your Sitecore Docker setup ADMIN user is not present e.g., in case of Sitecore Demo Edge setup the ADMIN user name is superuser and it's not present in above screen shot it means user not getting created.
- Step 3: Reset the Sitecore Admin Password
If you are certain that the username is correct and it's present in [Sitecore.Core].[dbo].[aspnet_Users] but still receive the error, it is possible that the password has been changed or forgotten. To reset the Sitecore Admin password to "b" from SQL Server you can check following useful resources from Sitecore Community Members:
- Reset The Sitecore Admin Password To "b" From SQL Server
- Is there a way to reset Sitecore admin password from database level?
- Reset Admin password in Sitecore 10.2 using SQL in Azure CM instance
- Step 4: Validate the Sitecore database credentials
The issue may lie with the database credentials used by Sitecore. Follow these steps to validate the database credentials:
- Open the Sitecore Docker .env file of your Sitecore Docker Setup
- Look for the SQL_SA_LOGIN and SQL_SA_PASSWORD environment variables
- Now you can Open the Docker Desktop and insept the Sitecore CM service to verify the Sitecore database credentials and it should matched with user id and password mentioned in the .env file
- Step 5: Check the Sitecore logs
To troubleshoot any issues that may be occurring on your website. The logs can provide valuable information about errors, warnings, and other events that could impact the performance of your site. It is important to regularly review the logs to ensure that your website is running smoothly and to quickly address any issues that may arise.
For this, we have to check the Sitecore logs including the mssql-init service logs.
I didn't found any specific error details in the Sitecore CM logs but mssql-init service logs contains error related to SSL Certificate in StartInit.ps1, CreateSitecoreAdminUser.sql and CreateSitecoreAuthorUser.sql files present at docker/build/mssql-init/tools/scripts:
Finish deploying 'Sitecore.core' dacpac. Invoke-Sqlcmd : 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.) At C:\StartInit.ps1:76 char:10 + $ready = Invoke-Sqlcmd -ServerInstance $SqlServer -Username $SqlAdmin ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlExcept ion + FullyQualifiedErrorId : SqlExceptionError,Microsoft.SqlServer.Management .PowerShell.GetScriptCommand
It means some issue with execution of SQL scripts which create the Sitecore users.
- Step 6: Validate MS SQL Image version
Thanks to Alexander Doroshenko from Sitecore, and he suggested to have latest version of MS SQL image and for this try running docker pull mcr.microsoft.com/mssql/server:2019-latest
If mssql-init logs contains error related to MS SQL connection trust like
Then we need to pass -TrustServerCertificate to all Invoke-SqlCmd commands in the following scripts
The code changes present at
Invoke-Sqlcmd : 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.)
Then we need to pass -TrustServerCertificate to all Invoke-SqlCmd commands in the following scripts
The code changes present at