Sonarqube stage in jenkins pipeline fails with 403 error have a pipeline job which keeps failing on Sonar Quality Gate stage with the below error:


  [Bitbucket] Build result notified
  org.sonarqube.ws.client.HttpException: Error 403 on
  http://illinXXXX:XXXXX/api/qualitygates/project_status?analysisId=XXXXXXXX
      at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:34)


What's more strange, another pipeline from the same MS, is passing that stage. They both are using the same Sonarquebe user and token, and the same stage syntax. 

Sonarqube version: 6.7.1 (build 35068).

Notes:


I also tried this, but it didn't work.
The logger for org.sonarqube.ws.client not working. it doesn't write anything to the log.
Problem:
The execution user/group had permissions to run  “Execute Analysis”
Solution:
Update the default template with permissions and push to projects (Bulk Apply Template)