SonarQube tasks for Azure Pipelines
This page describes the tasks supported by the Azure DevOps extension for SonarQube Cloud you can use in your Azure build pipeline.
Prepare Analysis Configuration task
This task configures the required settings before executing the build. For .NET solutions or Java projects, it helps integrate seamlessly with MSBuild, Maven, and Gradle tasks.
Task inputs common to all modes
The table below lists the Prepare Analysis Configuration task inputs common to all modes of the Azure DevOps extension for SonarQube Cloud.
Task input | Description | Required in YAML file |
---|---|---|
SonarCloud | Name of the SonarQube service connection(s) (SonarQube Service Endpoint) to your Azure DevOps project. See Adding SonarQube Cloud service connection to Azure Pipelines in Setting up project integration with Azure Pipelines. | x |
scannerMode | The running mode of the Azure DevOps extension for SonarQube Cloud. Possible values:
| x |
Task inputs specific to the Maven / Gradle mode
The table below lists the Prepare Analysis Configuration task inputs specific to the Maven / Gradle mode of the Azure DevOps Extension for SonarQube Cloud.
Input | Description | Required in YAML file |
---|---|---|
extraProperties | Additional sonar properties to be passed to the scanner. A property is defined through a [key, value] pair. Format: One [key, value] pair per line as follows: | x (to set the project key) |
Task inputs specific to the .NET mode
The table below lists the Prepare Analysis Configuration task inputs specific to the .NET mode of the Azure DevOps extension for SonarQube Cloud. The Corresponding sonar property column indicates the sonar property that SonarQube Cloud will set with the input value. See the sonar property description in Analysis parameters for more information on the possible values and default-from-build values.
Task input | Description | Corresponding sonar property | Required in YAML file |
---|---|---|---|
projectKey |
| sonar.projectKey | x |
projectName | The name of the SonarQube Cloud project that will be displayed on the web interface. Default: | sonar.projectName | |
projectVersion | The version of the SonarQube Cloud project. | sonar.projectVersion | |
dotnetScannerVersion | The version of the SonarScanner for .NET to be downloaded. See Using a specific SonarScanner version. Default: The extension’s default version of the SonarScanner for .NET (the latest compatible version). |
Task inputs specific to the CLI mode
The table below lists the Prepare Analysis Configuration task inputs specific to the CLI mode of the Azure DevOps Extension for SonarQube Cloud. The Corresponding sonar property column indicates the sonar property that SonarQube Cloud will set with the input value. See the sonar property description in Analysis parameters for more information on the possible values and default-from-build values.
Task input | Description | Corresponding sonar property | Required in YAML file |
---|---|---|---|
cliSources | The path to the root directory containing source files. The path can be absolute, or relative to the repository root. Warning: The possible values are different from the
Default: . | sonar.sources | x |
configMode | Specifies the configuration mode. Possible values:
| x | |
cliScannerVersion | Version of the SonarScanner CLI to be downloaded. See [link] Default: The extension’s default version of the SonarScanner CLI (the last available version). | ||
configFile | Is used if Default: sonar-project.properties | ||
cliProjectKey | Is used if
| sonar.projectKey | x |
cliProjectName | Is used if The name of the SonarQube Cloud project that will be displayed on the web interface. Default: | sonar.projectName | |
cliProjectVersion | Is used if configMode is set to manual .The version of the SonarQube Cloud project. | sonar.projectVersion | |
extraProperties | Is used if Additional sonar properties to be passed to the scanner. A property is defined through a [key, value] pair. Format: One [key, value] pair per line as follows: |
Run Code Analysis task
This task executes the analysis of the source code. It is not used in the Gradle / Maven mode of the Azure DevOps Extension for SonarQube Cloud.
The table below lists the task inputs.
Task input | Description |
---|---|
| The version of Java used by the scanner for analysis. If you select a value other than JAVA_HOME, the analyze task will revert to using JAVA_HOME if the selected environment variable does not exist. Possible values:
Default: |
Publish Quality Gate Result task
This task allows you to report the quality gate status directly to your Azure Pipeline's Build Summary page. It is not mandatory but highly recommended.
The Publish Quality Gate Result task can significantly increase the overall build time because it will poll SonarQube until the analysis is complete.
The table below lists the task inputs.
Task input | Description |
---|---|
pollingTimeoutSec | The maximum time (in seconds) for the task to wait for the analysis results sent by SonarQube Cloud. Default: 300 |
Related pages
- Adding analysis to your Azure pipeline for a Gradle or Maven project
- Adding analysis to your Azure pipeline for a .NET project
- Adding analysis to your Azure pipeline for a C family project
- Adding analysis to your Azure pipeline for a JS, TS, GO, Python, PHP or other project
- Adding analysis to your Azure pipeline for a monorepo
Was this page helpful?