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

PowerBI REST API - Update datasource with credentialType 'Azure Active Directory - Password'

Hi all,

Currently, I'm looking for a solution how to update datasource crenditials with 'Azure Active Directory - Password' via PowerBI REST API. Great help comes already from the documentation page: https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/updatedatasource.

I've managed to update datasource credentials with credentialType 'Basic' with the following working code:

 

string username = "UserName"
string password = "Secret101"

string credentials = $"{{\"credentialData\":[{{\"name\":\"username\", \"value\":{JsonConvert.SerializeObject(username)}}},{{\"name\":\"password\", \"value\":{JsonConvert.SerializeObject(password)}}}]}}";
                        
CredentialDetails credentialDetails = new CredentialDetails(credentialType: "Basic", credentials: credentials, encryptedConnection: "Encrypted", encryptionAlgorithm: "None", privacyLevel: "None");
UpdateDatasourceRequest updateDatasourceRequest = new UpdateDatasourceRequest(credentialDetails);

client.Gateways.UpdateDatasource(gatewayDatasource.GatewayId, gatewayDatasource.Id, updateDatasourceRequest);

 

But now I want to use 'Azure Active Directory - Password' as authentication as in SSMS (see screenshot below).  What credentialType do I have to use for example?

Capture.PNG

 

 

 

 

 

Thanks in advance!

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors