Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Rest API Update Datasource returns an error when using UseCallerAADIdentity

Hi All!


I have automated process that is uploading reports and datasource from pbix to PowerBI service. After datasource is there I'm trying to update credentials. I use UseCallerAADIdentity attribute during Update Datasource call ( The api call returns error 500. With only one line in payload "Error occured". 


I use following body:


"credentialDetails" = @{
"credentialType" = "OAuth2"
"useCallerAADIdentity" = "True"
"encryptedConnection" = "Encrypted"
"encryptionAlgorithm" = "None"
"privacyLevel" = "Private"
Does anybody know what is wrong here?
I can also see that the parameter seems to be correct accoring these tests -
Line 71.


I have found a similar question that is without answer:

Regular Visitor

Hi  @v-shex-msft

I'm sorry for late feedback this. Thanks you for your answer. 


I previosly have tried to execute GetDatasources REST Api call to check the parameters, but the response does not help me. Here is a response




 @odata.context :$metadata#datasources value : {@ {datasourceType=Extension; connectionDetails=; datasourceId=...............; gatewayId=.....} } 



I also tried to get information about my datasource

with following endpoint 

This return following: 



@odata.context    :$metadata#gatewayDatasources/$entity
id                : ....
gatewayId         : ....
datasourceType    : Extension
connectionDetails : {"extensionDataSourceKind":"AzureDataExplorer","extensionDataSourcePath":""}
credentialType    : OAuth2
credentialDetails : @{useEndUserOAuth2Credentials=False} 




To give you more context I would say that I have used Kusto connector and the credentials object should be empty if theuseCallerAADIdentity is set to true. The idea is to use the AAD identity of the calling (app that will embed the report) application. 

Community Support
Community Support

Hi @oyermokhin,

I think this error may mean you have used the invalid request contents of the API.
For this scenario, I'd like to suggest you use the get data source API to get the detail data source configurations then you can modify them with new credentials.

Datasets - Get Datasources - REST API (Power BI Power BI REST APIs) | Microsoft Docs


Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.