Pull request analysis not allowed by SonarCloud - Branch analysis OK

  • Azure DevOps Pull Request cannot be analyzed.
    Analysis of the branch works fine, but analysis of the pull request fails with the message :

Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator

Sonar token, project key and Organization are all the same.

Is there any settings in the Organization Administration settings that could block the PR analysis ?
I tried to check with our Org administrator, but we could not foind anything that could prevent PR analysis.

If I run on my private Org, on which I’m admin, then it works fine.

Maybe someone got the same issue already ?



Pipeline code :

script: |
        $baseBranch="$(System.PullRequest.TargetBranch)" -replace "refs/heads/", ""

  - task:  SonarCloudPrepare@1
    condition: and(succeeded(), eq(variables.isPR, 'true'))
    displayName: SonarqubePrepare - Pull request only
      SonarCloud: "SonarCloud******"
      organization: "********"
      scannerMode: 'MSBuild'
      projectKey: '*********-project'
      projectName: '********-project'
      projectVersion: '$(Build.BuildNumber)'
      extraProperties: |

Hey there.

Take a look at this post:

I would really recommend making sure you check both places (org-level and project-level)

thank you. Indeed, that’s what I thought also. I’ll check again as soon the admin is back from vacation

1 Like