You're not authorized to run analysis with SonarCloud + Azure DevOps + gradle + Android project


please help me to understand why the below mentioned build pipeline can’t be executed without failure. We have an Android project built by gradle in an Azure DevOps environment which is connected through an organization that is configured on SonarCloud. I created our own project in this organization where I am an admin. The pipeline yaml snippet is attached below. I was able to run the sonarqube on my local pc and was able to send data to SonarCloud, which I think means that the permissions should be all right. That’s why I don’t understand why this config fail with authentication error.
Could you please help me?

Thanks in advance.

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used when applicable (private details masked)
  • task: SonarCloudPrepare@1
    SonarCloud: ‘smp-hermes’
    organization: ‘smp-solutions-zrt’
    projectKey: ‘smp-hermes’
    scannerMode: ‘Other’

    • task: Gradle@2
      displayName: ‘Build’
      gradleWrapperFile: ‘gradlew’
      options: ‘–build-cache --stacktrace’
      tasks: ‘build jacocoUnitTestReport’
      publishJUnitResults: true
      testResultsFiles: ‘**/TEST-*.xml’
      javaHomeOption: ‘JDKVersion’
      jdkVersionOption: ‘1.8’
      gradleOptions: ‘-Xmx3072m’
      sonarQubeRunAnalysis: true
      sqGradlePluginVersionChoice: ‘specify’
      sonarQubeGradlePluginVersion: ‘3.0’
  • task: SonarCloudPublish@1
    pollingTimeoutSec: ‘300’

  • Languages of the repository: Android, Kotlin, Java

  • Error observed:

> Task :sonarqube FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonarqube'.
> You're not authorized to run analysis. Please contact the project administrator.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(
	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(

Hi @fraviktor

Do you have any file somewhere ? If yes, does it contain any sonar.login / sonar.password ?


Hi @mickaelcaro
No, we didn’t have any sonar-related data in our repository.

Is it a microsoft hosted agent, or do you host it by yourself ?

Microsoft hosted

Ok. Will it be possible for you to send me (privately if needed) the log of the task, in debug mode please ?

That would help troubleshoot.

Thanks in advance.

Unfortunately I don’t know how to send a message to you (maybe I don’t even have permission to do that? :slight_smile: ).
I prepared some debug logs for you, please let me know how can I send them to you privately.
Thanks in advance.

Issue was resolved by adding sonar.projectKey in the additional properties field of the Prepare analysis configuration.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.