Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
xli629b
Helper II
Helper II

Updating credentials for a cloud data source as a service principal

I'm trying to update credentials for a cloud data source that uses OAuth2 as a service principal. The purpose is to be able to refresh the dataset. We would prefer not to use an on-premises gateway for our use case. 

There is an Updata Datasource method that updates the credentials for gateway datasources, but it does not appear to work for cloud datasources. Based on this post, I was actually able to find a gateway ID and data source ID for a cloud data source, but updata datasource always returned status 400 DM_GWPipeline_Gateway_DataSourceAccessError for it.

Is there actually a way to update credentials for a cloud data source as a service principal? Or is this an inherent limitation; I saw that this says "Cloud data sources and their corresponding credentials are managed at the user level."

6 REPLIES 6
Andrew-T2
Frequent Visitor

Has anyone resolved this? I too find that cloud datasources credential updates don't seem to work (400 DM_GWPipeline_Gateway_DataSourceAccessError), and are mostly forgotten in the on-prem gateway oreinted documentation.

Trying to add a cloud datasource to the on-prem gateway doesn't help either.
Get Datasource Status didn't work for me either.

We were eventually able to get this to work by calling Update Datasource with the cloud datasource gateway ID returned by Get Datasources. However, the following conditions also had to be true:

1)  Used plain credentials, not encrypted ones:

{
    credentialDetails: {
      credentialType: "OAuth2",
      credentials: "{\"credentialData\":[{\"name\":\"accessToken\",\"value\":\"eyJh[...]\"}]}",
      encryptedConnection: "Encrypted",
      encryptionAlgorithm: "None",
      privacyLevel: "None",
      useEndUserOAuth2Credentials: "False"
    }
}


2) Used a service principal profile to upload the report/dataset and for all operations.

 

lbendlin
Super User
Super User

You need to send the new token in the payload of the call.

 

Gateways - Update Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Docs

This works fine for datasources that are part of a gateway, but it does not work for cloud (non-gateway) datasources.

I can't believe I am saying this but you can add cloud data sources to your gateway.  ( I strongly dislike that, but it might help in your case)

So ideally, we'd prefer not to have to maintain on-premises gateways. However, if that's the only workaround, we might end up having to do it.

The other possibility I'm considering is to use a master user instead of a service principal because we can manually set credentials on app.powerbi.com for it, and the credentials can last for a long time. This has other drawbacks though.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.