Forum Discussion

lupa0682's avatar
lupa0682
New Member
4 years ago

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/***********************************************/executeQueries. 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/***********************************************/executeQueries. Response: ,Source=Microsoft.DataTransfer.ClientLibrary,'

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

Thanks,

WJ

2 Replies

  • 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.