Power BI: Add bigquery service account key file
Asked Answered
D

3

8

I am trying to add a service account key file to access a bigquery data set in power bi. I am selecting service account login during the set up process. I added the service account email as well as pasted in the contents of the service account key file however I am getting authentication failed errors. This service account key file is confirmed to be working in other places it just does not work in power bi.

There is no documentation regarding what user roles/ permissions are needed.

The service account has the below permissions/ roles

BigQuery Data Viewer BigQuery Metadata Viewer BigQuery Job User BigQuery Read Session User

Any other idea how to get this to work?

Digestion answered 3/3, 2022 at 0:14 Comment(0)
D
6

This is ridiculous that this is not documented in any sort of power bi page. It turns out that the power bi dialog box where you paste the service account key cannot handle any white space so you have to squash the json into 1 single line. Everything worked as expected afterwards. I hope this post saves someone some pain and suffering in the future.

https://w3percentagecalculator.com/json-to-one-line-converter/

Digestion answered 3/3, 2022 at 1:17 Comment(3)
Can you add a link to the documentation on using a Google service account with Power BI? I am interested in this integration.Bulahbulawayo
@JohnHanley Near the bottom of this page learn.microsoft.com/en-us/power-query/connectors/googlebigqueryDigestion
Bloody life saver. Thanks for this.Engine
F
3

The "no newline" requirement is now documented by Power BI for the Google BigQuery connector.

As a best practice, don't paste credentials into third-party websites to strip newlines.

If you're on a Mac or Linux, just do tr -d '\n' < /path/to/serviceaccount/credentials.json. This output works correctly in Power BI.

Froemming answered 5/5, 2022 at 7:50 Comment(0)
T
0

As suggested by the other answers, after downloading the service key, make sure to remove all the newlines (\n) from the file. Do NOT remove any other characters like spaces or tabs, since they are required.

For the permissions of the service account, I had to choose the following:

  • bigquery data viewer
  • bigquery job user
  • bigquery read session user
Tullis answered 11/8, 2024 at 13:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.