User Profile
oyermokhin
Regular Visitor
Joined 5 years ago
User Widgets
Contributions
Re: Rest API Update Datasource returns an error when using UseCallerAADIdentity
Hi Anonymous 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.2.6KViews0likes1CommentRest 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/7627262.7KViews0likes4CommentsRe: Using service principal for the datasource credentials
I use following method to set datasource credentials - https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource $patchBody = @{ "credentialDetails" = @{ "credentials" = "{""credentialData"":[{""name"":""accessToken"",""value"":""$AccessToken""}]}" "credentialType" = "OAuth2" "encryptedConnection" = "NotEncrypted" "encryptionAlgorithm" = "None" "privacyLevel" = "Private" } } The AccessToken I get using following code $requestAccessTokenUri = "https://login.microsoftonline.com/$Dataset_TenantId/oauth2/token"; $body = "grant_type=client_credentials&client_id=$Dataset_ClientId&client_secret=$Dataset_ClientSecret&resource=$KustoClusterUrl" $token = Invoke-RestMethod -Method Post -Uri $requestAccessTokenUri -Body $body -ContentType 'application/x-www-form-urlencoded' This token is valid only for 1 hour, I can set it to be valid for 23h 59m using token lifetime policy, but after that my report will stop working I know that other azure services also accept refresh token, so they can issues new access token automatically, but I can't provide refresh token to powerbi4.7KViews0likes0CommentsUsing service principal for the datasource credentials
Hi! I use service principal to connect from PowerBI service to Azure Data Explorer (direct query mode). Pbix is file uploaded to service via power shell. After that I get oauth2 access token for my service principal and set it to the datasource with a help of https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource#credentialdetails Everything works fine exepct that max lifetime for the access token that I can get is 1 day. So after that my reports get unauthorized errorr. I can't find a way to provide refresh token to datasource and it is not clear if it is supported anyhow. Is there any workaround to use service principal? Thanks in advance!4.8KViews0likes4Comments
Data Privacy
Microsoft Fabric Community and Privacy
To learn more about how we manage your data, please review the Microsoft Fabric Community Data Privacy guide.