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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jimmcslim
Helper III
Helper III

How to update credentials of a connection with V2 API in package Microsoft.PowerBI.Api 2.0.10?

Is it possible to use the Power BI V2 API to update connection details (e.g. set the connection username and password) using the Nuget package Microsoft.PowerBI.Api 2.0.10? Primarily interested in setting the connection details of either Azure SQL or Azure Table Storage connections in PBIX that I have imported through my custom front-end.

 

This package has namespaces for both the V1 and V2 APIs... are the issues with using both in an application?

 

 

2 REPLIES 2
v-ljerr-msft
Employee
Employee

Hi @jimmcslim,

 

Have you tried using the UpdateDatasourceAsync function within Nuget package Microsoft.PowerBI.Api to update cloud source credentials in your scenario? The code below is for your reference. Smiley Happy

                var credentialDetails = new CredentialDetails();
                credentialDetails.CredentialType = "Basic";
                credentialDetails.Credentials = "";
                var updateDatasourceRequest = new UpdateDatasourceRequest(credentialDetails);
                await client.Gateways.UpdateDatasourceAsync("gatewayId", "datasourceId", updateDatasourceRequest);

 

Regards

Sorry, but your sample doesn't really help me.

 

In the context of an Azure SQL (not Analysis Services, and not on-prem) or Azure Table Storage datasource, what should be the value of gatewayId and datasourceId? How do I use the REST API/Nuget package to get these values? I have tried to use the IPowerBIClient.Groups, IPowerBIClient.Reports, and IPowerBIClient.Datasets APIs to enumerate the objects and while I can lookup groups, reports and datasets, there are no datasources linked to my dataset and no gateways in my IPowerBIClient.Gateways call.

 

Maybe best to take the discussion to the linked issue below, which was similar to a question of mine.

 

https://community.powerbi.com/t5/Developer/Patching-an-Online-DirectQuery-datasource/m-p/351230

 

(Unfortunately it appears my response to the above thread has been squashed).

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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