Share via

Unable to Update Power BI Datasource Credentials for Google BigQuery Using OAuth2 Access Token via Update Datasource API

Bảo 0 Reputation points
2026-05-13T03:53:49.25+00:00

Dear Microsoft Support Team,

We are using the Power BI Update Datasource API described here:

https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource

We are trying to update credentials for a dataset datasource of type Google BigQuery using credentialType: "OAuth2".

API request:

PATCH https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}/datasources/{datasourceId} 
Authorization: Bearer <Power_BI_Access_Token> 
Content-Type: application/json

Request body:

{
	"credentialDetails": {
		"credentialType": "OAuth2",
		"credentials": "{\"credentialData\":[{\"name\":\"accessToken\",\"value\":\"<Google_OAuth2_Access_Token>\"}]}",
		"encryptedConnection": "Encrypted",
		"encryptionAlgorithm": "None",
		"privacyLevel": "None"   
	}
}

The Power BI access token in the Authorization header is valid, and we can call other Power BI APIs successfully. The gatewayId, datasourceId, and dataset information are also correct.

However, when the datasource is Google BigQuery, updating the credential with a Google OAuth2 access token always fails with errors such as:

DM_GWPipeline_Gateway_InvalidConnectionCredentials
AccessUnauthorized

The same OAuth2 update approach works for Google Sheets, but not for Google BigQuery.

Could you please confirm:

  1. Is credentialType: "OAuth2" officially supported for updating Google BigQuery datasource credentials via this API?
  2. Can we use an externally generated Google OAuth2 access token in the accessToken field?
  3. If OAuth2 is not supported for BigQuery, what is the recommended API-based approach?
  4. Should BigQuery use Service Account credentials with Basic authentication instead?

This issue is blocking our automated datasource update and refresh flow for Google BigQuery reports.

Thank you.

Microsoft Partner Center API
0 comments No comments

2 answers

Sort by: Most helpful
  1. Bảo 0 Reputation points
    2026-05-13T06:07:56.95+00:00

    The documentation for Gateways – Update Datasource API (https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource?utm_source=chatgpt.com) explains that credentialType: "OAuth2" is supported in general and provides an example payload using accessToken inside credentialData.

    However, the documentation does not clearly state whether this API supports updating credentials for a datasource whose resource type is Google BigQuery.

    In practice, when using the documented OAuth2 payload format with a Google OAuth2 access token for a BigQuery datasource, the update fails with errors such as:

    AccessUnauthorized
    

    The documentation should clarify:

    1. Whether Google BigQuery is supported by this API. 
    2. Whether OAuth2 accessToken update is supported for Google Bigquery.
    3. Whether externally generated Google OAuth2 access tokens can be used.
    4. The recommended API payload or authentication method for BigQuery, if different from the generic OAuth2 example.
    

    Currently, the documentation only describes the generic credential format, but it does not explain connector-specific behavior. This makes it difficult to determine whether Google BigQuery failures are caused by an implementation issue or by an unsupported scenario.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-05-13T03:54:03.2033333+00:00
    1. The context only confirms that credentialType: "OAuth2" is supported in general for gateway datasources when calling the Gateways – Update Datasource API, including the pattern of passing an accessToken inside credentialData. It does not state that Google BigQuery is supported or list per-connector limitations, so support for OAuth2 with Google BigQuery via this API cannot be confirmed from the provided information.
    2. The context shows that for OAuth2 credentials the API accepts a JSON string of the form:
    "credentials": "{\"credentialData\":[{\"name\":\"accessToken\",\"value\":\"eyJ…\"}]}"
    

    and that this is used together with "credentialType": "OAuth2" in the credentialDetails object when calling Gateways – Update Datasource. This demonstrates the expected shape of the payload when using an access token, but the documents do not explicitly state that externally generated tokens for Google BigQuery are supported or recommended.

    1. The context does not provide any connector-specific guidance or exceptions for Google BigQuery, nor any alternative API-based pattern specific to BigQuery when OAuth2 fails. It only describes the generic pattern for configuring credentials programmatically (including OAuth2, key, basic, Windows, and anonymous) and the requirement to encrypt credentials when using an on-premises gateway.
    2. The context lists supported credential types (Windows, Basic, Key, OAuth2, Anonymous) and how to construct them, but does not state that Google BigQuery should use service account credentials mapped to Basic authentication, nor does it describe a BigQuery-specific mapping of service account keys to any of these credential types.

    Based on the provided material, only the generic credential patterns and the Update Datasource usage can be described; connector-specific behavior for Google BigQuery, including whether OAuth2 with an externally generated Google token is supported or how to model service account credentials, is not covered.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.