> ## Documentation Index
> Fetch the complete documentation index at: https://prowler-feat-supabase-provider-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Prowler product naming: Prowler App is now Prowler Local Server, and Prowler Enterprise is now Prowler Private Cloud. Always use the current names when answering. The full product reference is at /getting-started/products: Open Source projects are Prowler CLI, Prowler Local Server, Prowler Local Dashboard, and Prowler SDK; Prowler Products are Prowler Cloud, Prowler Private Cloud, Prowler Hub, Prowler Lighthouse AI, and Prowler MCP.

# GCP Authentication in Prowler

Prowler for Google Cloud supports multiple authentication methods. To use a specific method, configure the appropriate credentials during execution:

* [**User Credentials** (Application Default Credentials)](#application-default-credentials-user-credentials)
* [**Service Account Key File**](#service-account-key-file)
* [**Access Token**](#access-token)
* [**Service Account Impersonation**](#service-account-impersonation)

## Required Permissions

Prowler for Google Cloud requires the following permissions:

### IAM Roles

* **Viewer (`roles/viewer`)** – Must be granted at the **project, folder, or organization** level to allow scanning of target projects.
* **Service Usage Consumer (`roles/serviceusage.serviceUsageConsumer`)** IAM Role – Required for resource scanning.
* **Custom `ProwlerRole`** – Include granular permissions that are not included in the Viewer role:
  * `storage.buckets.getIamPolicy`

### Project-Level Settings

At least one project must have the following configurations:

* **Identity and Access Management (IAM) API (`iam.googleapis.com`)** – Must be enabled via:

  * The [Google Cloud API UI](https://console.cloud.google.com/apis/api/iam.googleapis.com/metrics), or
  * The `gcloud` CLI:

  ```sh theme={null}
  gcloud services enable iam.googleapis.com --project <your-project-id>
  ```

* **Service Usage Consumer (`roles/serviceusage.serviceUsageConsumer`)** IAM Role – Required for resource scanning.

* **Quota Project Setting** – Define a quota project using either:

  * The `gcloud` CLI:

  ```sh theme={null}
  gcloud auth application-default set-quota-project <project-id>
  ```

  * Setting an environment variable:

  ```sh theme={null}
  export GOOGLE_CLOUD_QUOTA_PROJECT=<project-id>
  ```

<Note>
  Prowler will scan the GCP project associated with the credentials.
</Note>

## Application Default Credentials (User Credentials)

This method uses the Google Cloud CLI to authenticate and is suitable for development and testing environments.

### Setup Application Default Credentials

1. In the [GCP Console](https://console.cloud.google.com/), click "Activate Cloud Shell"

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/mhJQaAejI1lK27qo/images/providers/access-console.png?fit=max&auto=format&n=mhJQaAejI1lK27qo&q=85&s=8e079857b7d87a4c0057317d2ce4b595" alt="Activate Cloud Shell" width="2699" height="822" data-path="images/providers/access-console.png" />

2. Click "Authorize Cloud Shell"

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/KzNPdHkMeXASKVPY/images/providers/authorize-cloud-shell.png?fit=max&auto=format&n=KzNPdHkMeXASKVPY&q=85&s=5e6fd30f4d85b551b795f1c607dd2514" alt="Authorize Cloud Shell" width="1179" height="396" data-path="images/providers/authorize-cloud-shell.png" />

3. Run the following command:

   ```bash theme={null}
   gcloud auth application-default login
   ```

   * Type `Y` when prompted

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/KzNPdHkMeXASKVPY/images/providers/run-gcloud-auth.png?fit=max&auto=format&n=KzNPdHkMeXASKVPY&q=85&s=78e32ac32adbace5a5b3b976c8da9453" alt="Run Gcloud Auth" width="1042" height="263" data-path="images/providers/run-gcloud-auth.png" />

4. Open the authentication URL provided in a browser and select your Google account

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/ob861A0sTNe5hi6g/images/providers/take-account-email.png?fit=max&auto=format&n=ob861A0sTNe5hi6g&q=85&s=84d47b5fa6162285246f7c1a20eab8f0" alt="Choose the account" width="1199" height="732" data-path="images/providers/take-account-email.png" />

5. Follow the steps to obtain the authentication code

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/KzNPdHkMeXASKVPY/images/providers/copy-auth-code.png?fit=max&auto=format&n=KzNPdHkMeXASKVPY&q=85&s=f0e7619cff401f78fc15942ecf6befea" alt="Copy auth code" width="612" height="742" data-path="images/providers/copy-auth-code.png" />

6. Paste the authentication code back in Cloud Shell

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/KzNPdHkMeXASKVPY/images/providers/enter-auth-code.png?fit=max&auto=format&n=KzNPdHkMeXASKVPY&q=85&s=517a92b0ab1460359bb70ee53cb3243d" alt="Enter Auth Code" width="1736" height="442" data-path="images/providers/enter-auth-code.png" />

7. Use `cat <file_name>` to view the temporary credentials file

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/KzNPdHkMeXASKVPY/images/providers/get-temp-file-credentials.png?fit=max&auto=format&n=KzNPdHkMeXASKVPY&q=85&s=d9db9bad37a2768b042ea6daa1cc600a" alt="Get the FileName" width="1640" height="446" data-path="images/providers/get-temp-file-credentials.png" />

8. Extract the following values for Prowler Cloud or Prowler Local Server:

   * `client_id`
   * `client_secret`
   * `refresh_token`

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/KzNPdHkMeXASKVPY/images/providers/get-needed-values-auth.png?fit=max&auto=format&n=KzNPdHkMeXASKVPY&q=85&s=10996fd6fea010fdf7ba1d054111b446" alt="Get the values" width="2266" height="429" data-path="images/providers/get-needed-values-auth.png" />

### Using with Prowler CLI

Once application default credentials are set up, run Prowler directly:

```console theme={null}
prowler gcp --project-ids <project-id>
```

## Service Account Key File

This method uses a service account with a downloaded key file for authentication.

### Step 1: Create ProwlerRole

To keep permissions focused:

1. Create a custom role named **ProwlerRole** that explicitly includes the permissions your compliance team approves. Click **Create role**, set the title to *ProwlerRole*, keep the ID readable (for example, `prowler_role`)
2. Add the required permission `storage.buckets.getIamPolicy` (the permission highlighted in the screenshots). To make it easier, filter the permissions by `Storage Admin` role.

<img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/XUhXOOcbVVxDgQcx/user-guide/providers/gcp/img/roles-section.png?fit=max&auto=format&n=XUhXOOcbVVxDgQcx&q=85&s=7321c125dc996a8cbbb159c08c95ceff" alt="Create a custom Prowler role" width="2558" height="1124" data-path="user-guide/providers/gcp/img/roles-section.png" />

<img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/XUhXOOcbVVxDgQcx/user-guide/providers/gcp/img/prowler-role.png?fit=max&auto=format&n=XUhXOOcbVVxDgQcx&q=85&s=0156edb5aed10a9f2589b608bfdefbee" alt="Sample permissions for a custom Prowler role" width="2538" height="1812" data-path="user-guide/providers/gcp/img/prowler-role.png" />

### Step 2: Create the Service Account

1. Navigate to **IAM & Admin > Service Accounts** and make sure the correct project is selected.

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/XUhXOOcbVVxDgQcx/user-guide/providers/gcp/img/service-account-page.png?fit=max&auto=format&n=XUhXOOcbVVxDgQcx&q=85&s=1ae5ce39a4c01a5f033e3017146e3d5f" alt="Service accounts landing page" width="2584" height="1034" data-path="user-guide/providers/gcp/img/service-account-page.png" />

2. Select **Create service account**, provide a name, ID, and a short description that states the purpose (for example, “Service account to execute Prowler”), then click **Create and continue**.

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/XUhXOOcbVVxDgQcx/user-guide/providers/gcp/img/create-service-account.png?fit=max&auto=format&n=XUhXOOcbVVxDgQcx&q=85&s=913ff103348e484eba711fed0e9931c2" alt="Create service account wizard" width="2560" height="1396" data-path="user-guide/providers/gcp/img/create-service-account.png" />

3. Assign the roles you prepared earlier:

   * **ProwlerRole** for `cloudstorage` service checks.
   * **Viewer** for broad read-only visibility.
   * **Service Usage Consumer** so Prowler can inspect API states.

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/XUhXOOcbVVxDgQcx/user-guide/providers/gcp/img/service-account-permissions.png?fit=max&auto=format&n=XUhXOOcbVVxDgQcx&q=85&s=c4266745d7a7cf92d16bcff79a5ce4ed" alt="Assign roles to the service account" width="2560" height="1806" data-path="user-guide/providers/gcp/img/service-account-permissions.png" />

4. Continue through the wizard and finish. No principals need to be granted access in step 3 unless you want other identities to impersonate this account.

<Note>
  To use this service account with `--organization-id`, additionally grant `roles/cloudasset.viewer` at the organization node and enable the Cloud Asset API in the service account's host project. See [Scanning a Specific GCP Organization](./organization). Without these, organization-wide scans silently fall back to listing only the projects accessible to the service account.
</Note>

### Step 3: Generate a JSON Key

1. Open the newly created service account, move to the **Keys** tab, and choose **Add key > Create new key**.

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/XUhXOOcbVVxDgQcx/user-guide/providers/gcp/img/create-new-key.png?fit=max&auto=format&n=XUhXOOcbVVxDgQcx&q=85&s=c7ca4b2811ecc8940771d0ad29783835" alt="Add a new key to the service account" width="1667" height="705" data-path="user-guide/providers/gcp/img/create-new-key.png" />

2. Select **JSON** as the key type and click **Create**. The browser downloads the file exactly once.

   <img src="https://mintcdn.com/prowler-feat-supabase-provider-poc/XUhXOOcbVVxDgQcx/user-guide/providers/gcp/img/json-key.png?fit=max&auto=format&n=XUhXOOcbVVxDgQcx&q=85&s=b5834027aab3f35f36e1f96b56fa8e5d" alt="Select JSON as the key type" width="1080" height="636" data-path="user-guide/providers/gcp/img/json-key.png" />

3. Once created, make sure to store the Key securely.

### Using with Prowler CLI

Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable:

```console theme={null}
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
prowler gcp --project-ids <project-id>
```

## Access Token

For existing access tokens (e.g., generated with `gcloud auth print-access-token`), run Prowler with:

```bash theme={null}
export CLOUDSDK_AUTH_ACCESS_TOKEN=$(gcloud auth print-access-token)
prowler gcp --project-ids <project-id>
```

<Note>
  When using this method, also set the default project explicitly:

  ```bash theme={null}
  export GOOGLE_CLOUD_PROJECT=<project-id>
  ```
</Note>

## Service Account Impersonation

To impersonate a GCP service account, use the `--impersonate-service-account` argument followed by the service account email:

```console theme={null}
prowler gcp --impersonate-service-account <service-account-email>
```

This command leverages the default credentials to impersonate the specified service account.

### Prerequisites for Impersonation

The identity running Prowler must have the following permission on the target service account:

* `roles/iam.serviceAccountTokenCreator`

Or the more specific permission:

* `iam.serviceAccounts.generateAccessToken`
