TedPattison / DatasetManagement

Sample code using C# and Power BI .NET SDK to manage Power BI datasets
MIT License
4 stars 1 forks source link

UpdateDatasource exceptions #1

Closed BISQLC closed 3 years ago

BISQLC commented 3 years ago

Hi Ted,

great project!

I've been fighting with various approaches to update a pbi datasource. It needs to be set to use OAuth, and use the report viewer's credentials. It's using direct query. I've got an app registered in azure ad for the c# 4.8 console app I'm playing with. Its service principle has all pbi permissions for delegate and application. I'm using DatasetManagement.ModelsPowerBiManagerAppOnly to take over the dataset (TakeOverDataset(), this is working, as are the other Get methods), but when I run PatchSqlDatasourceCredentials(), I get a 'BadRequest' response. The username and password are fine - I can take ownership myself in pbi and update the connection with them. The user is a workspace admin, as am I and the service principle.

Any ideas? Is it still working for you?

Thanks!

BISQLC commented 3 years ago

Same error happens with the PowerBiManager class.

BISQLC commented 3 years ago

Hmmm, I wonder if it's because the tenant doesn't have a Power BI Embedded nor a PBI Premium license?

BISQLC commented 3 years ago

I think I've answered this. The API in this project does require Embedded to be set up. I found your comments on this thread: https://community.powerbi.com/t5/Developer/Possible-to-update-credentials-via-REST-API/m-p/137509 And the REST approach instead of the the embedded approach in this project here: https://github.com/CriticalPathTraining/PbixInstallerForPowerBI