> 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-server/2025.6/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 Server 2025.6 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.

For more information about the Azure DevOps integration solution, see [Introduction to Bitbucket Cloud integration](/sonarqube-server/2025.6/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/introduction.md#integration-overview).

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

## Prerequisites

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

## Step 1: Create your OAuth client

SonarQube Server uses a dedicated [OAuth client](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/) to report your quality gate status on pull requests. 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 Server 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**. In Step 2, enter the client ID in **OAuth Key** and the secret in **OAuth Secret**. If you want to enter the secret in SonarQube Server in encrypted format, you can encrypt this secret.

See [Sensitive settings](/sonarqube-server/2025.6/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**.

<div align="left"><figure><img src="broken://spaces/KXW79zfYFiA8incTvwZK/files/tzVAK2LVsMGtgBjwxaar" alt="Select Bitbucket Cloud in the Create a configuration dialog." width="440"><figcaption></figcaption></figure></div>

4. Specify the following settings:
   * **Configuration Name** (Enterprise and Data Center Edition only): The name used to identify your Bitbucket Cloud configuration at the project level. Use something succinct and easily recognizable.
   * **Workspace ID**: The workspace ID is part of your bitbucket cloud URL `https://bitbucket.org/<workspace-id>/<repository-slug>`
   * **OAuth Key**: The key you created in Step 1.
   * **OAuth Secret**: The secret you created in Step 1.

## Related pages

[Importing Bitbucket Cloud repositories](/sonarqube-server/2025.6/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/import-repos.md)\
[Setting up Bitbucket Cloud integration for your project](/sonarqube-server/2025.6/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/project.md)\
[Adding analysis to Bitbucket pipeline](/sonarqube-server/2025.6/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/bitbucket-pipelines.md)\
[Troubleshooting](/sonarqube-server/2025.6/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-server/2025.6/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.
