cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dan2 Regular Visitor
Regular Visitor

Unable to update user-password using API UpdateDatasourceWithHttpMessagesAsync

We moved the dashboards from v1 (workspace collections) to v2 (app workspaces). In doing so we have a deployment process that called the c# powerbi API to update the datasource username/passwords. In V1 there was a PatchDatasource method. In V2 this is non-existant. In V2 there is a UpdateDatasourceWithHttpMessagesAsync which I have tried to use but unsuccessful.

 

I have so far found no actual examples of how to call this successfully. I have found several forum posts but none if this is fruitful. 

 

The closest example was found at https://community.powerbi.com/t5/Developer/How-do-I-update-the-Credentials-after-I-upload-a-report-t...

This example provides a separate method to encrypt basic credential but gives no information on how to find the gateway public key or gateway public key modulus. In trying to query for the gateway using the c# api method GetGatewaysWithHttpMessagesAsync this always returns zero gateways. So cannot go any futher using this partial example.

 

The other url's which I have looked at where other users are wanting to find the gateway public keys or having issues with updating the datasource credentials are below. And I see the same similar issues I am addressing above.

https://community.powerbi.com/t5/Developer/Update-Credentials-C/m-p/271635

https://community.powerbi.com/t5/Developer/Automating-Power-BI-Gateway-administration-by-using-Power...

 

So the main question, is there a full code example of where this has been successfully done that can be reviewed? 

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Dan2 Regular Visitor
Regular Visitor

Re: Unable to update user-password using API UpdateDatasourceWithHttpMessagesAsync

For anyone who is having the same issue I found the below url which is a c# code that is a full example. I had to modfiy the code to fit my scenario, but it helped resolve the issue of updating the datasource. I had to manually call the rest calls as could not get the C# API to do this.

 

https://github.com/CriticalPathTraining/PbixInstallerForPowerBI

 

2 REPLIES 2
Dan2 Regular Visitor
Regular Visitor

Re: Unable to update user-password using API UpdateDatasourceWithHttpMessagesAsync

For anyone who is having the same issue I found the below url which is a c# code that is a full example. I had to modfiy the code to fit my scenario, but it helped resolve the issue of updating the datasource. I had to manually call the rest calls as could not get the C# API to do this.

 

https://github.com/CriticalPathTraining/PbixInstallerForPowerBI

 

jimmcslim Member
Member

Re: Unable to update user-password using API UpdateDatasourceWithHttpMessagesAsync

Hi Dan,

 

Glad you found a solution.

 

It is disappointing that no-one from Microsoft has come along and provided an official answer or, better yet,provided  a decent update to the documentation and code samples for the V2 API - especially since they are sending out emails to users of the Azure Workspaces API notifying them that it will be switched off in a few months!

 

I will note however that the Microsoft.PowerBi.Api Nuget package was updated a couple of days ago, so maybe that has better support for this?

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 346 members 4,115 guests
Please welcome our newest community members: