google-bigquerygoogle-cloud-storage

BigQuery authorization


I am trying to use the bq command line tool to load data into BigQuery from GCS bucket and I receive the following error message:

BigQuery error in load operation: Access Denied: Job mythical-maxim-293:bqjob_r11765e0cd9ceb52b_000001427694f0e1_1: RUN_JOB

I was using service account (with private key) for authentication. I followed the following links for granting the service account access level:

https://developers.google.com/bigquery/loading-data-into-bigquery https://developers.google.com/bigquery/access-control

The service account email was granted WRITE access with the BigQuery dataset and READ access with the GCS bucket.

Note: Adding the service account email as a writer to the project, solved the issue but this is not feasible for my case. I am not allowed to request project level write access but BigQuery and GCS (readonly).

Thanks!


Solution

  • In order to run the job, the service account must be given at least READ permissions on the project. This is because whoever runs a job in the project can do things that cost the project owner money (e.g. run queries).

    To add the service account to the project, go to https://cloud.google.com/console, then click on "Permissions", then "Add member".