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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors