> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/global.md).

# Setting up Bitbucket Cloud integration at global level

How to set up Bitbucket Cloud and SonarQube Community Build for integration at the global level.

This section explains how to set up Bitbucket Cloud and SonarQube to allow users to import Bitbucket Cloud repositories. To perform this setup, you need the global Administer System permission in SonarQube.

You can also open the **DevOps Platform Integrations** page from **Administration** > **Project coverage**. See the [Project coverage](/sonarqube-community-build/project-coverage.md) page.

{% hint style="info" %}
To set up Bitbucket Cloud authentication in your SonarQube Community Build instance, see [Bitbucket Cloud](/sonarqube-community-build/instance-administration/authentication/bitbucket-cloud.md).
{% endhint %}

## Prerequisites

You’ve set a SonarQube Community Build base URL in SonarQube Community Build: see [Server base URL](/sonarqube-community-build/instance-administration/server-base-url.md).

## Step 1: Create your OAuth client

SonarQube Community Build uses a dedicated [OAuth client](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/) to access your Bitbucket Cloud workspace. When you create your OAuth client, Bitbucket Cloud generates a client ID and a secret that you need in Step 2.

Proceed as follows:

1. In your Bitbucket Cloud workspace settings, create an OAuth client and specify the following:
   * On the **Details** tab, **Name**: The name of your OAuth client.
   * On the **Authorization** tab, **Supported grant types**: Select **Client credentials**. SonarQube Community Build does not use the **Authorization code** or **Refresh token** grant types, so you do not need a callback URL.
   * On the **Scopes** tab: Grant **Read** access for the **Pull requests** permission.
2. Retrieve the client ID and secret of your OAuth client in your Bitbucket Cloud workspace settings under **OAuth clients**. You need them in Step 2. If you want to enter the secret in SonarQube Community Build in encrypted format, you can encrypt this secret.

See [Sensitive settings](/sonarqube-community-build/instance-administration/security/encrypting-settings.md) for more information about settings encryption.

## Step 2: Create a Bitbucket Cloud configuration record

This integration is performed through a "Bitbucket Cloud Configuration" record, which is used in SonarQube to access the Bitbucket Cloud instance.

{% hint style="info" %}
Starting in SonarQube Server's[ Enterprise edition](https://www.sonarsource.com/plans-and-pricing/enterprise/), you can integrate SonarQube with multiple Bitbucket Cloud instances, each instance being accessed with a different Bitbucket Configuration.
{% endhint %}

To set up a Bitbucket Configuration in SonarQube:

1. Go to **Administration** > **Configuration** > **General Settings** > **DevOps Platform Integrations**.
2. Select the **Bitbucket** tab and click **Create configuration**. The **Create a configuration** dialog opens.
3. Select **Bitbucket Cloud**.

<figure><img src="broken://spaces/KXW79zfYFiA8incTvwZK/files/j4DZoHDtC1iLhIm6xFYU" alt="Select Bitbucket Cloud in the Create a configuration dialog."><figcaption></figcaption></figure>

4. Specify the following settings:
   * **Workspace ID**: The workspace ID is part of your bitbucket cloud URL `https://bitbucket.org/<workspace-id>/<repository-slug>`
   * **Client ID**: The client ID you retrieved in Step 1.
   * **Client Secret**: The secret you retrieved in Step 1.

## Related pages

[Importing Bitbucket Cloud repositories](/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/import-repos.md)\
[Adding analysis to Bitbucket pipeline](/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/bitbucket-pipelines.md)\
[Troubleshooting](/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/troubleshooting.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-community-build/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/global.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
