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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TheBiConsultant
Frequent Visitor

How to update the Credentials of a dataset that use a datalflow as source (with the API)

Hi


In order to be able to refresh datasets on the demand, we have configured an "service principal"  in azure following a rather advanced guide. 

It works and we can now refresh datasets on demand, if the dataset is using our Gateway as a source. In order for the Service Principal to be able to refresh any dataset, it needs to perform a "Takeover"  of the dataset first using Powershell and the API. 

 

The Problem is this: now when we want the dataset to use a dataflow as a source (e.g. not the gateway) and we perform the takeover, the oauth2 credentials between the dataset and the dataflow are erased and must be re-entered using the API (powershell). 

 

This is the error message when we issue the refesh command:

Invoke-PowerBIRestMethod -Url 'groups/$GroupID/datasets/$DataSetId/refreshes' -Method Post

 

"It looks like the refresh failed because at least one data source is missing credentials. To start the refresh again, go to this dataset's settings page and enter credentials for all data sources."

 

Since it is not possible to log in as the Service Principal  and do this manually using the regular web interface, we need of figure out how to do it using the API.

 

I dont understand how to do this can someone help. 

I have only found the following information

Solved: Programmatically enter missing dataset credentials... - Microsoft Power BI Community

but it seems irrelevant since the dataset is not using a gateway

 

 

Thanks!

 

1 ACCEPTED SOLUTION
blopez11
Resident Rockstar
Resident Rockstar

The service principal doesn't need to take over the dataset.  The service principal can just be used for authentication to use the Power BI REST APIs.  You might have already done it, but you'll need to give the service principal API permissions on the Power BI service (Dataset.ReadWrite.All), permissions to use the Power BI REST APIs (in the Power BI tenant settings) and, I believe the workspace admin role where the dataset resides.  You can keep ownership of the dataset as yourself, and it will work.  This is the way we have done it.

View solution in original post

2 REPLIES 2
blopez11
Resident Rockstar
Resident Rockstar

The service principal doesn't need to take over the dataset.  The service principal can just be used for authentication to use the Power BI REST APIs.  You might have already done it, but you'll need to give the service principal API permissions on the Power BI service (Dataset.ReadWrite.All), permissions to use the Power BI REST APIs (in the Power BI tenant settings) and, I believe the workspace admin role where the dataset resides.  You can keep ownership of the dataset as yourself, and it will work.  This is the way we have done it.

Ok so I tried without the takeover and it worked, how nice!

(I have tried before without takeover on a dataset that was connected directly to gateway and that did not work so that is why I did not even bother to try)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors