Skip to main content

Prerequisites

You’ll need to create a custom role and service account in GCP. This role and service account must be added to each Project you want Sidecar to ingest metadata for.

1. Setting up a role and service account

Create a custom role in GCP

  1. Navigate to Roles in the IAM & Admin section.
  2. Click the + Create Role button.
  3. Give the new role a name such as Sidecar Data BigQuery.
  4. Click + Add Permissions, and add the following permissions:
serviceusage.services.use lets Sidecar use the service account project for API quota and billing. Keep it in this custom role; no additional IAM role is required for this access.
  1. Click Create to create the role.
  2. Repeat the role creation process for each Project you want Sidecar to ingest metadata for.

Create a service account

  1. Navigate to Service accounts in the IAM & Admin section.
  2. Click + Create Service Account.
  3. Give the new service account a name like sidecar-data.
  4. Under “Grant this service account access to project”, select the custom role you created above.
  5. Click Done.
  6. For all other Projects you want Sidecar to ingest metadata for:
    1. Navigate to IAM in the IAM & Admin section.
    2. Click + Grant Access.
    3. Under “Add principals”, enter the email address generated for the service account.
    4. Under “Assign roles”, select the custom role you created.
    5. Click Save.

2. Create and download key credentials

  1. For your primary Project, navigate to Service accounts in the IAM & Credentials section.
  2. Find the service account you created for Sidecar, click the 3 dots and click Manage keys.
  3. Click Add key, then Create new key.
  4. Select JSON as the Key type.
  5. Click Create. This will download a JSON file to your machine.

3. Upload your service account key to Sidecar

  1. In the Onboarding page (or Account Settings), navigate to “Connect your data warehouse” and select “BigQuery”.
  2. Select the downloaded JSON key file from Step 2.
  3. Click Test then Save.

4. Additional permissions

  • Cloud Resource Manager API and Cloud Asset API must be enabled.
  • Add the Cloud Asset Viewer role to the Sidecar service account.

5. Optional Storage Read API activity

Spark, Dataproc, and other clients can read BigQuery tables through the Storage Read API without creating a query job. Complete this setup if you want Sidecar to treat those direct reads as activity when evaluating query activity.Sidecar reads from one dedicated Cloud Logging view for each BigQuery integration. The view must receive matching events from every project that owns BigQuery tables selected in Sidecar.
Reuse the service account and JSON key from steps 1–3. You don’t need a new service account or key. The existing logging.operations.list permission does not grant access to Data Access logs.
Logging sinks route only new log entries. Creating a sink with 90-day retention does not backfill the previous 90 days. Existing recommendations might remain until the affected table is read again.

Before you begin

Gather the following values:
  • Sidecar service account email: the client_email in the JSON key you uploaded to Sidecar.
  • BigQuery project IDs: every project that owns tables selected in the Sidecar integration.
  • Logging project ID: the project that will own the dedicated log bucket and view. For one BigQuery project, use that same project.
  • Retention period: use at least 90 days. If your Sidecar deprecation inactivity threshold is longer than 90 days, use at least that threshold plus one day.
Enable logging.googleapis.com in the logging project and in the service account’s project (project_id in the JSON key). These are often the same project. Ensure the Sidecar custom role is granted to the service account in that project and includes serviceusage.services.use. If the custom role was created only in other projects, create or update the same project-level custom role here and grant it to the Sidecar service account. No other Service Usage permissions are required for this setup.

Create the log bucket

  1. Select the logging project in the Google Cloud Console.
  2. Open APIs & Services → Library → Cloud Logging API and click Enable if the API isn’t already enabled.
  3. Open Logging → Logs Storage and click Create log bucket.
  4. Enter sidecar-bigquery-storage-reads as the bucket name.
  5. Choose a location and record it. The location can’t be changed later.
  6. Set the retention period determined above.
  7. Leave Upgrade to use Observability Analytics unchecked. Sidecar doesn’t require it.
  8. Click Create bucket.
Google Cloud charges additional retention costs for logs kept longer than 30 days.

Route Storage API reads into the bucket

Repeat these steps in every BigQuery project selected in Sidecar:
  1. Select the BigQuery project in the Google Cloud Console.
  2. Open Logging → Log Router and click Create sink.
  3. Enter sidecar-bigquery-storage-reads as the sink name.
  4. Choose Cloud Logging bucket as the sink service.
  5. Select the dedicated bucket. If the bucket is in another project, use its full destination:
  6. In Build inclusion filter, enter:
  7. Add no exclusion filters and click Create sink.
  8. If the bucket is in a different project, open the sink details and copy its writer identity. In the logging project, grant that identity Logs Bucket Writer (roles/logging.bucketWriter). A same-project destination doesn’t need this grant.
A project-level sink sees only logs that originate in that project. The Spark or Dataproc execution project isn’t a substitute for a project that owns selected BigQuery tables.

Create the restricted log view

  1. Return to Logging → Logs Storage in the logging project.
  2. Open the sidecar-bigquery-storage-reads bucket.
  3. Under Log views, click Create log view.
  4. Enter sidecar-bigquery-storage-reads as the view name.
  5. Enter this view filter:
  6. Save the view.
  7. From the view’s Actions menu, select Adjust permissions.
  8. Add the Sidecar service account email and assign Logs View Accessor (roles/logging.viewAccessor).
Grant the role on the view itself. Don’t grant Sidecar roles/logging.privateLogViewer, project-level roles/logging.viewAccessor, roles/logging.bucketWriter, or a Logging administration role.

Add the view to Sidecar

Copy the complete view resource name. It has this format:
In Sidecar, open Integrations → BigQuery, enter this value in Storage Read LogView resource name, and click Save. Enter the full resource name, not a Google Cloud Console URL or a project ID.

Verify the view

After a new Spark or direct Storage API read completes, run this command in Cloud Shell:
Sink and IAM changes can take several minutes to propagate. If your organization uses intercepting sinks, confirm that a fresh test read reaches this dedicated view.Learn more in Google’s guides to route logs, manage log buckets, and configure log views.

Add BigQuery MCP to Agent Console

The warehouse connection above does not automatically provide query tools to agents. The mcp.tools.call permission in the custom role enables Google’s managed MCP servers. Follow Set up BigQuery MCP to confirm the connection.