I’m using SonarCloud with the Azure DevOps Pipeline integration for Pull Request annotations.
A few days ago the Gradle build task started failing with the following error message:
Project not found. Please check the ‘sonar.projectKey’ and ‘sonar.organization’ properties, the ‘SONAR_TOKEN’ environment variable, or contact the project administrator
My first thought is that this is a permissions issue too. We saw a case like this recently where the user who owned the token being used for analysis had left the organization. Can you take a look at whether the token in use for this project is still valid?
Indeed, the user that was used for the analysis left the organisation. But we deleted and recreated the service connection with an admin user. Verification was also successful:
There are two tokens that needed to be exchanged, right:
The SonarCloud Token for Azure DevOps service connection. We did that for the new admin user and as shown in the last post this seems to be working fine.
We added Azure DevOps PAT with Code Read & Write permissions (I think that is what you mean by Browse and Execute) to the Pull Request configuration page of the project.
The documentation states:
Entering the PAT at the organization vs the project level in SonarCloud can lead to differing behavior. We recommend that you follow the tutorial to create a bound organization and make sure that the PAT is entered only at the organization level, not at the project level. The project-level field should be left blank.
Is that something that can lead to this error? I haven’t found a way to change the configuration on the organization level.
The user in step 1 doesn’t need special permissions, right?
In the administration panel of the organization we had to give the user execute rights and also on the organizational level the connection to Azure DevOps was not set properly.
So to do it only on the project level was not sufficient.