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

TThe setup is different depending on whether you use YAML or the Azure Classic interface.

{% hint style="info" %}

* The use of the Classic interface 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 %}

## Before you start <a href="#before-you-start" id="before-you-start"></a>

Before starting, read [Azure Pipelines integration overview](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/azure-pipelines-integration-overview.md).

The prerequisites are:

* The Azure DevOps Extension is installed in your Azure DevOps organization: see [Azure DevOps Extension](/sonarqube-cloud/analyzing-source-code/scanners/sonarcloud-extension-for-azure-devops.md).
* Your project is created in SonarQube Cloud and:
  * Your project binding with you DevOps platform has been configured. See the [Configuring Azure DevOps project binding](/sonarqube-cloud/managing-your-projects/administering-your-projects/devops-platform-integration/azure-devops.md).
  * Your project has been configured for Azure Pipelines. See [Configuring project for Azure Pipelines](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/setting-up-project-integration.md).
* The pull request and branch analysis are enabled in your pipeline.

If you need to use a specific scanner version, see the [Using various features](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/adding-analysis-to-build-pipeline/various-features.md#specific-scanner-version) article for instructions.

## 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 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 [List of SonarQube tasks](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/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 `SonarCloudPrepare@3`, `@3` should correspond to the version of the [Azure DevOps Extension](/sonarqube-cloud/analyzing-source-code/scanners/sonarcloud-extension-for-azure-devops.md) you’re using.
{% endhint %}

<details>

<summary>YAML file example</summary>

<pre class="language-yaml"><code class="lang-yaml"><strong>trigger:
</strong>- 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: SonarCloudPrepare@4
  inputs:
    SonarCloud: '&#x3C;YourSonarQubeServiceEndpoint>'
    organization: '&#x3C;YourOrganizationName>'
    scannerMode: 'cli'
    configMode: 'manual'
    cliProjectKey: '&#x3C;YourProjectKey>'

# Add your build task(s) here

# Run Code Analysis task
- task: SonarCloudAnalyze@4
  inputs:
    jdkversion: 'JAVA_HOME_17_X64'

# Publish Quality Gate Result task
- task: SonarCloudPublish@4
  inputs:
    pollingTimeoutSec: '300'
</code></pre>

</details>

## Using the Classic interface <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-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/adding-analysis-to-build-pipeline/various-features.md) page.

Proceed as follows:

1. In Azure DevOps’ Classic interface editor, create or edit your build pipeline.
2. Add a **Prepare Analysis Configuration** task before your build task:
   * In **SonarQube Server Service Endpoint**, select the SonarQube service connection you created during setup. See the [Configuring project for Azure Pipelines](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/setting-up-project-integration.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 Cloud analysis to run automatically.
6. Save your pipeline.

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

* [Configuring project for Azure Pipelines](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/setting-up-project-integration.md)
* [Gradle or Maven project](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/adding-analysis-to-build-pipeline/gradle-or-maven-project.md)
* [.NET project](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/adding-analysis-to-build-pipeline/dotnet-project.md)
* [C family project](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/adding-analysis-to-build-pipeline/c-family-project.md)
* [Monorepo projects](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/adding-analysis-to-build-pipeline/monorepo-projects.md)
* [List of SonarQube tasks](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/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-cloud/analyzing-source-code/ci-based-analysis/azure-pipelines/adding-analysis-to-build-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.
