As the solution provided here https://community.sonarsource.com/t/sonarqube-publish-quality-gate-result-error-400-api-get-api-ce-task-failed-status-code-was-400/47735/4 is too old and didn't work for me, I have finally succeeded on SonarQube Publish Quality Gate with the below fix:
Generate a new Token from SonarQube on My Account > Security > Generate Tokens > Generate a Token for the Project.
Copy and Paste the Token in your Azure DevOps. Go to Project settings > Service connections > Add the token we have generated.
Note: for this activity, we need Admin rights for the Project.
Re-run the pipeline.