Forum Discussion
Unable to trigger fabric data pipeline using REST API's
Hi,
I have recently created, microsoft data fabric trail account with 60 day trail.
And under this trail account, I am trying to invoke microsoft data fabric data pipeline using Postman/from some external client.
Based on the docuementation(i.e. https://learn.microsoft.com/en-us/fabric/data-factory/pipeline-rest-api#obtain-an-authorization-token), I tried to optain the token with below curl:
curl --location 'https://login.microsoftonline.com/tanentId/oauth2/v2.0/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=myclientId' \
--data-urlencode 'client_secret=mysecret' \
--data-urlencode 'scope=https://api.fabric.microsoft.com/.default' \
--data-urlencode 'grant_type=client_credentials'
I get the token, but when i am using the same token to rigger the pipline using below curl. but i get 401 error with message "The caller is not authenticated to access this resource". please help how can i proceed.
curl --location --request POST 'https://api.fabric.microsoft.com/v1/workspaces/myworkspaceid/items/mypiplelineid/jobs/instances?jobType=Pipeline' \
--header 'Authorization: Bearer <token>' \
--data ''
Thanks.
munnas - The API that you use to trigger a Fabric Data Pipeline does not support Service Principals. You have to use a named user account & password. They will be bringing service pricipal support to more API's in the future.
It does work with Username/Password as we are able to do that within our Company. It will eventually work in Power Automate but since the API does not return a response the HTTP Post with Azure Entra (preauthorized) does not function properly.
There is another thread in the community that goes into more detail. It's fairly recent.
Jeremy
8 Replies
- jwinchell40Resolver III
munnas - The API that you use to trigger a Fabric Data Pipeline does not support Service Principals. You have to use a named user account & password. They will be bringing service pricipal support to more API's in the future.
It does work with Username/Password as we are able to do that within our Company. It will eventually work in Power Automate but since the API does not return a response the HTTP Post with Azure Entra (preauthorized) does not function properly.
There is another thread in the community that goes into more detail. It's fairly recent.
Jeremy
- munnasRegular Visitor
jwinchell40 thanks for the response. could you please some example how you are able to trigger the datapipleline.
- FabianSchutSolution Sage
You can take a look at this topic: https://community.fabric.microsoft.com/t5/Data-Pipeline/How-to-trigger-an-on-demand-run-to-a-pipeline-from-a-API/m-p/4248175
- lbendlinSuper User
Evaluate your token at jwt.io most likely you have misconfigured the application scope. Don't use delegated permissions.
- munnasRegular Visitor
I have already configured the application under Microsoft Entra ID (https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade).
Below is a screenshot showing the application permissions that were added. Since microsoft fabric was not available, I added application permissions for the Power BI service instead.
Thanks.
- lbendlinSuper User
Since microsoft fabric was not available, I added application permissions for the Power BI service instead.I would call this the "money tree approach". You may want to investigate if there are Fabric specific permissions, either already implemented or planned.
- FabianSchutSolution Sage
Did you add the service principal to access the workspace where the data pipeline is in with sufficient permissions? You do not need any application permissions as shown in the screenshot. Also make sure that your service principal is able to run REST APIs. This can be set in the Power BI (Fabric) admin settings.