cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
oyermokhin
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 (https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource). 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 - https://github.com/microsoft/PowerBI-CSharp/blob/master/sdk/PowerBI.Api.Tests/CredentialsTests.cs
Line 71.
 

 

I have found a similar question that is without answer:

https://community.powerbi.com/t5/Developer/Rest-API-Update-Datasource-UseCallerAADIdentity-or/td-p/7...

2 REPLIES 2
oyermokhin
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 : http://wabi-north-europe-redirect.analysis.windows.net/v1.0/myorg/groups/........../$metadata#datasources value : {@ {datasourceType=Extension; connectionDetails=; datasourceId=...............; gatewayId=.....} } 

 

 

I also tried to get information about my datasource

with following endpoint 

GET https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}/datasources/{datasourceId}
This return following: 

 

 

@odata.context    : http://wabi-north-europe-redirect.analysis.windows.net/v1.0/myorg/$metadata#gatewayDatasources/$entity
id                : ....
gatewayId         : ....
datasourceType    : Extension
connectionDetails : {"extensionDataSourceKind":"AzureDataExplorer","extensionDataSourcePath":"https://.....westeurope.kusto.windows.net"}
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. 

v-shex-msft
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

Regards,

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

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors