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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.