My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and index you

Troubleshooting Steps to Resolve the "Invalid Username or Password" Error in Sitecore Docker setup

Problem Statement
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!
Error Analysis
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:



  • 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

Solution
If mssql-init logs contains error related to MS SQL connection trust like

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

  • CreateSitecoreAdminUser.ps1
    The CreateSitecoreAdminUser.ps1 script present at docker/build/mssql-init/tools/scripts/CreateSitecoreAdminUser.ps1 and following changes applied:


  • CreateSitecoreAuthorUser.ps1
    The CreateSitecoreAuthorUser.ps1 script present at docker/build/mssql-init/tools/scripts/CreateSitecoreAuthorUser.ps1 and following changes applied:


  • StartInit.ps1
    The StartInit.ps1 script present at docker/build/mssql-init/tools/scripts/StartInit.ps1 and following changes applied:


The code changes present at

Pingback:
Building custom Sitecore images Copying Files To And From Docker Containers - Baeldung Understanding Docker Volumes
Sitecore/docker-examples: Companion code for the Containers in Sitecore development Sitecore Docker images repository
Installing / Running the Examples | Sitecore Helix Examples Best practices for writing Dockerfiles | Docker Documentation Docker: adding a file from a parent directory - Stack Overflow
Optimizing Your Dockerfile. The ordering of instructions in a… | by Erik Kristensen | Medium Dockerfile Cheat Sheet - Kapeli A tutorial on building a Docker image for Sitecore
sitecore kafka Sitecore Content Migration Using Sitecore Express Migration Tool Sitecore xDB Migration Using Sitecore xDB Data Migration Tool
How to use Sitecore SwitchOnRebuildSolrSearchIndex on Solr slave Indexes which are replicated from Master Index
invalid username or password invalid username or password meaning remote invalid username or password
sitecore password policy invalid username or password sitecore sitecore identity server invalid redirect_uri
sitecore default password sitecore default admin password disable sitecore identity server
sitecore enable identity server sitecore login url sitecore sif install
sitecore jss install jss sitecore github j_security_check error
sitecore jss commands citrix incorrect username or password okta sitecore
sitecore okta integration sitecore item name valid characters sitecore xconnect certificate
sitecore xconnect certificate expired sitecore 10 identity server sitecore an invalid/missing hash value was encountered
sitecore containers sitecore docker container sitecore docker compose
Walkthrough: Updating Managed Cloud How to upgrade Sitecore Managed Cloud Containers How do I upgrade my Sitecore 8 to 10?
How to setup Docker and Sitecore? What are Sitecore containers? What is the purpose of a .ENV file when deploying Sitecore to containers?
How do I upgrade from Sitecore 8.2 to 9? What is the difference between Sitecore 8 and 9? sitecore docker-compose
sitecore containers github sitecore docker installation sitecore installation guide
sitecore upgrade guide sitecore container upgrade guide sitecore docker-tools
sitecore xp1 mssql-init How do I install Sitecore 10? Why upgrade to Sitecore 10?
How do I update my Sitecore license? What is the difference between Sitecore version 9 and 10? sitecore docker cheat sheet
sitecore-id6 sitecore-id7 sitecore containers
Installation and Upgrade Guides - Sitecore Documentation Sitecore Upgrades: Get the Latest Platform and Features Why upgrade to Sitecore Experience Platform 10.1?
Why You Should Upgrade to Sitecore 10 Upgrade Sitecore Headless Services to version 19.0.0 Upgrade Sitecore Headless Services to version 21.0.0
How do I update Sitecore? Why upgrade from Sitecore 9 to 10? How do I upgrade from Sitecore 8.2 to 9?
Why upgrade to Sitecore 10? Sitecore upgrade to latest version sitecore upgrade guide
sitecore upgrade from 9.1 to 10 sitecore upgrade from 8.2 to 10 sitecore versions
sitecore 10.2 upgrade guide sitecore version history sitecore 10.3 release date
sitecore version support Why you need an API Layer in Sitecore Composable Architecture? Mind the order of instructions in a Dockerfile for Sitecore Containers
Start using Sitecore GraphQL API Sitecore Helix Recommendation and Conventions - Helix 2.0 What’s new in Sitecore 10
Analysis for Sitecore Experience Accelerator (SXA) based website implementation Secure Sitecore JSS Site Sitecore Experience Accelerator (SXA)
Sitecore Graphql tutorial Sitecore Performance Tuning Sitecore GraphQl Examples
What is SXA Page Design? Sitecore Installation and Upgrade Guides Speed Up Sitecore Upgrade with PackageReference
Upgrade to Sitecore 9 Sitecore Version 10 - Sitecore Upgrade Process Sitecore 10 Upgrade
sitecore docker sitecore docker images sitecore docker examples
github sitecore docker images sitecore docker registry sitecore docker getting started
sitecore docker github sitecore docker cheat sheet sitecore docker tools
sitecore docker compose sitecore docker for traefik container is unhealthy sitecore with docker
sitecore docker access to the path is denied sitecore on docker sitecore and docker
sitecore docker container sitecore docker azure sitecore-docker-tools-assets
sitecore 10 docker architecture sitecore docker containers sitecore docker container registry
sitecore docker custom images sitecore docker container unhealthy sitecore docker documentation
Sitecore JavaScript Rendering SDK (JSS) for Next.js sitecore headless architecture sitecore jss docker
sitecore disconnected mode sitecore first jss sitecore jss headless
sitecore jss helix sitecore jss nextjs sitecore nodejs
sitecore nextjs sitecore ssr next js sitemap
sitecore cancel publish next js static site regeneration next.js or gatsby
Start using Sitecore GraphQL API Sitecore Helix Recommendation and Conventions - Helix 2.0 What’s new in Sitecore 10
Analysis for Sitecore Experience Accelerator (SXA) based website implementation Secure Sitecore JSS Site Sitecore Experience Accelerator (SXA)
Sitecore Graphql tutorial Sitecore Performance Tuning Sitecore GraphQl Examples
What is SXA Page Design? Sitecore Installation and Upgrade Guides Sitecore Upgrade Services

Comments

Popular posts from this blog

Sitecore GraphQL Queries

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container

Sitecore Experience Manager Cloud (XM Cloud) Building blocks