Skip to main content

How to Set Up a Google Cloud Service Account for BigQuery Access

Want to access specific BigQuery tables using a Google Cloud service account? Follow this step-by-step guide to get up and running.

B
Written by BonData Support
Updated over 3 months ago

✅ Step 1: Create the Service Account

  1. Open the Service Accounts page in the Google Cloud Console.

  2. Click Create Service Account.

  3. Enter a Name (e.g. bq-reader) and optionally a Description.

  4. Click Create and Continue.


✅ Step 2: Assign Required Roles

On the “Grant this service account access to project” screen, add the following roles:

  • BigQuery Data Viewer – allows viewing of table data

  • BigQuery Job User – allows running SQL queries

You can skip Step 3 (granting users access to the service account) and just click Done.


✅ Step 3: Generate a JSON Key

From the list of service accounts, click the service account name you just created.

  1. Open the Keys tab.

  2. Click Add KeyCreate New Key.

  3. Select JSON, then click Create.

  4. A .json key file will be downloaded — keep this file secure.


✅ Step 4: Share Datasets with the Service Account

To limit access to specific datasets:

  1. In the left panel, expand your project and click on the dataset name (not the table).

  2. Click Share Dataset.

  3. Enter the service account’s email (e.g. [email protected]).

  4. Assign the BigQuery Data Viewer role.

  5. Click Save.

🔒 This ensures the service account only has access to datasets you explicitly grant.


🧠 Summary of Roles

Task

Role Needed

Read table data

BigQuery Data Viewer

Run SQL queries

BigQuery Job User

Limit access to datasets

Share dataset with service account

Did this answer your question?