ERROR: You’re not authorized to run analysis. Please contact the project administrator in Angular

I have tried to run sonar runner(npm run sonar) for my project but got this error. please support how we can fix this issue.
In sonar-project.properties:

sonar.host.url=https://sonarcloud.io
sonar.login = Encrypted Key
sonar.projectKey=myprojectKey
sonar.organization=myorganization
sonar.projectName=myprojectname
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.lcov.reportPaths=coverage/lcov.info



==============
INFO: Indexing files...
INFO: Project configuration:
INFO: Load project repositories
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 16.808s
INFO: Final Memory: 19M/70M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: You're not authorized to run analysis. Please contact the project administrator.
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

I have read this topic but it’s seem my error is different.

Hi,

Make sure that the user which created the token used to run the analysis has the Execute Analysis permission.
You can see that in Your project dashboard > Administration > Permissions.

1 Like

I’m new, and came here because I’m receiving this same error. I have manually adjusted my permissions to include both Execute Analysis and even Administer. The error message seems a little different now, but

Any suggestions?

I think I just figured this out. When going through the tutorial I wasn’t the one who set up the organization, so I was not familar about an existing “Update Key” setting. When I added the SonarCloud task, I entered a value similar to the one from the tutorial in the textbox, since it wasn’t a dropdown to choose from. They did not match. After I corrected the “Prepare analysis on SonarCloud” Project Key setting to match the Update Key in the SonarCloud dashboard, under Administration, the build completed successfully.

Welcome to our Community @JohnB! Nice that you figured out your problem. If you need further help don’t hesitate to contact us.

Regards,

Alexandre.

  • task: SonarCloudPrepare@1

    inputs:

    SonarCloud: ‘SonarCloud’

    organization: ‘unipe’

    scannerMode: ‘MSBuild’

    projectKey: ‘$(Build.Repository.Name)’

    projectName: ‘$(Build.Repository.Name)’

I am also facing same issue when I making as variables.