# JS, TS, Go, Python, PHP, etc. project

This page explains how to add the SonarQube Community Build analysis to your Azure build pipeline for projects that are not Maven, Gradle, or .NET.

Before you begin, see the [Azure Pipelines integration overview](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/azure-pipelines-integration-overview.md) page.

Once you have created and set up your SonarQube Community Build project, check out the [Creating and configuring your Azure DevOps project](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/creating-your-project.md) and [Setting up project integration](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/project-integation.md) pages for information about adding the SonarQube analysis to your Azure build pipeline.

To create your Azure build pipeline, you can use either YAML or the Azure Classic editor.

{% hint style="info" %}

* The use of the Classic editor is not always possible (e.g. if your code is stored on GitHub).
* If you use YAML, Sonar can provide you with YAML templates or code examples.
  {% endhint %}

If you need to use a specific scanner version, see the [Using various features](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/various-features.md) page.

## Using YAML <a href="#yaml-pipeline" id="yaml-pipeline"></a>

Add the following SonarQube tasks to your YAML pipeline:

1. Before your build task, add a Prepare Analysis Configuration task.
2. After your build task, add a Run Code Analysis task.
3. After the Run Code Analysis task, add a Publish Quality Gate Result task.

See the [#yaml-file-example](#yaml-file-example "mention") below. See also our [YAML pipeline templates](https://github.com/SonarSource/sonar-scanner-azdo/tree/master/its/fixtures). For information about the SonarQube task inputs, see the [SonarQube tasks for Azure Pipelines](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/sonarqube-tasks.md) page.

{% hint style="info" %}
Make sure the SonarQube task version used in your YAML file is the correct one.\
For example, in `SonarQubePrepare@7`, `7` should correspond to the version of the [Azure DevOps Extension](/sonarqube-community-build/analyzing-source-code/scanners/sonarqube-extension-for-azure-devops.md) you’re using.
{% endhint %}

<details>

<summary>YAML file example</summary>

```yaml
trigger:
- main # or another name representing your main branch
- feature/*

steps:
 # Checkout the repository
 - checkout: self
 
 # Disable shallow fetch
   fetchDepth: 0

# Prepare Analysis Configuration task
- task: SonarQubePrepare@8
  inputs:
    SonarQube: '<YourSonarqubeServerEndpoint>'
    scannerMode: 'cli'
    configMode: 'manual'
    cliProjectKey: '<YourProjectKey>'

# Add your build task(s) here

# Run Code Analysis task
- task: SonarQubeAnalyze@8
  inputs:
    jdkversion: 'JAVA_HOME_17_X64'

# Publish Quality Gate Result task
- task: SonarQubePublish@8
  inputs:
    pollingTimeoutSec: '300'
```

</details>

## Using the Classic editor <a href="#classic-pipeline" id="classic-pipeline"></a>

In the procedure below, the manual configuration mode is used to define analysis parameters at the pipeline level. You may use the `sonar-project.properties` file instead (or another specified configuration file). For more information, see the [Using various features](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/various-features.md) page.

Proceed as follows:

1. In the Azure DevOps’ Classic editor, create or edit your build pipeline.
2. Add a **Prepare Analysis Configuration** task before your build task:
   * In **SonarQube Service Endpoint**, select the SonarQube Server service connection you created during setup. See the [Setting up project integration](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/project-integation.md) page for more information about adding a connection.
   * Under **Choose a way to run the analysis**, select **Use Standalone SonarScanner CLI**.
   * Select the **Manually provide configuration** mode.
   * In the **Project key** field, enter your project key.
3. Add a new **Run Code Analysis** task after your build task.
4. Add a new **Publish quality gate Result** on your build pipeline summary.
5. Ensure that the pipeline runs automatically for all the branches you want:
   * Under the **Triggers** tab of your pipeline, select **Enable continuous integration** and select all the branches for which you want SonarQube Community Build analysis to run automatically.
6. Save your pipeline.

## Related pages <a href="#related-pages" id="related-pages"></a>

* [Gradle or Maven project](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/gradle-or-maven-project.md)
* [.NET project](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/dotnet-project.md)
* [Using various features](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/various-features.md) when adding the analysis to your pipeline
* [Quality gate status in release pipeline](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/quality-gate-status-in-release-pipeline.md)
* [SonarQube tasks for Azure Pipelines](/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/sonarqube-tasks.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-community-build/devops-platform-integration/azure-devops-integration/adding-analysis-to-pipeline/js-ts-go-python-php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
