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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lupa0682
New Member

Datasets - Execute Queries end point from within ADF

Hi community,

 

I do have the following issue:

 

I do try to tap this end point https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/executeQueries from ADF pipline but I get an error:

Failure happened on 'Source' side. ErrorCode=RestCallFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Rest call failed with client error, status code 403 Forbidden, please check your activity settings. Request URL: https://api.powerbi.com/v1.0/myorg/datasets/***********************************************/executeQ.... Response: ,Source=Microsoft.DataTransfer.ClientLibrary,'

 

This is my set-up:

Azure:

1. AD application registered in AAD

2. Security Group that the above application is a member of

PBI:

3. Allow service principals to use PowerBI API enabled in PBI admin and applicable to the above security group

4. The same security group added as admin to a workspace where dataset is published to

ADF:

5. I have 1 linked service, 1 activity and 1 data set:
                a. REST linked service for PowerBI api (https://api.powerbi.com/) using service prinicpal ID - test connection works

                b. REST data set, using above link service with this relative URL: v1.0/myorg/datasets/*****************************/executeQueries

                c. web activity "GetBearerToken" that send POST request                    to https://login.microsoftonline.com/microsoft.onmicrosoft.com/oauth2/token with this body: 

@concat('grant_type=client_credentials&client_id=',pipeline().parameters.ClientID,'&resource=https://analysis.windows.net/powerbi/api&client_secret=',pipeline().parameters.Secret)
to get access token back - it does work and I get TOKEN back
               c. copy data activity with a source that uses REST dataset (see paragraph b.)  and POST method with this body:
{
"queries": [
{
"query": "EVALUATE VALUES('SRRR_TWS Franklaw')"
}
],
"serializerSettings": {
"includeNulls": true
}
}

and this authotisation header: 
@concat('Bearer ',activity('GetBearerToken').output.access_token)

This activity does fail with the folowing error:
Failure happened on 'Source' side. ErrorCode=RestCallFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Rest call failed with client error, status code 403 Forbidden, please check your activity settings. Request URL: https://api.powerbi.com/v1.0/myorg/datasets/***********************************************/executeQ.... Response: ,Source=Microsoft.DataTransfer.ClientLibrary,'

Would anyone have any idea what I'm doing wrong here.

Thanks,

WJ

2 REPLIES 2
GilbertQ
Super User
Super User

Hi @lupa0682 

 

I have not tried it with ADF, but with the error 403 it does indicate that there is an authentication error as far as I can see.

 

Can you also make sure that this is enabled in your Power BI Admin Tenant settings as shown below.

GilbertQ_0-1659995326765.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

An update:

 

It does work now... In my REST linked service for https://api.powerbi.com/, I changed Authentication type from 'service principal' to 'Anonymous'. 

 

I do have a web activity to get a BearerToken, where I POST AD app credentials in request body to https://login.microsoftonline.com/********************.onmicrosoft.com/oauth2/token

 

REQUEST BODY: 

@concat('grant_type=client_credentials&client_id=',activity('GetAppClientID').output.value,'&resource=https://analysis.windows.net/powerbi/api','&client_secret=',activity('GetAppSecret').output.value)
 
Therefore, REST linked service is just pointing at generic, base URL (https://api.powerbi.com/) and it doesn't require any form of authentication.
 
I hope that makes sense.
 
Thanks for all your help,
 
Wojciech

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors