We’ve recently signed up for SonarCloud and trying to set it up. We’re hosting everything on AzureDevops and we can’t get it to work at all. Followed the setup guide carefully and did everything as said but we keep getting:
##[error]ERROR: Error during SonarScanner execution
ERROR: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator
ERROR:
ERROR: Error during SonarScanner execution
ERROR: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator
ERROR:
##[error]The SonarScanner did not complete successfully
We made sure that the projectKey and name are exactly like they are in SonarCloud (and in the tutorial) so they are not wrong. If anyone can help please let us know what to do as we are hardstuck on this step. Thanks!
I guess this is a private project? I ask because you’ve double-checked the projectKey and organization values, but there’s another possibility listed in that error message:
Tried multiple things today and no luck. I even included the file with the key and name and still doesn’t work with the same error. I re-ordered the steps in pipeline few different ways and still no luck. Made sure the key is ok and is set in the connection.
I would also suggest taking a look at your project-level Administration > Pull Requests or organization-level Administration > Organization settings > Azure DevOps connectivity management and make sure a valid token is set.
Made sure proper token is inserted in both location and it is. PAT token with full access provided in both locations and it still isn’t working.
Same error again
ERROR: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator
@vulegend the pipeline looks fine. A couple of things to recheck:
the user has Execute analysis permission. I’m guessing from what you’ve said that the project already exists in SonarCloud, so they shouldn’t need the ‘Create project’ permission.
re-create the token, and edit the Azure DevOps Service Connection to use the new token.
Also, can you analyse a simple dummy project with a different project key? (e.g. a newly-created empty .NET Core Class Library app)
If that doesn’t work, we’ll probably need to see the detailed logs for the SonarCloudPrepare and SonarCloudAnalyze steps, which means adding sonar.verbose = true to the SonarCloudPrepare step e.g.