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!

0 REPLIES 0

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors