Forum Discussion
Call Fabric data pipelines using notebooks via API's
- 1 year ago
1) Easiest way of calling the Fabric APIs from within a Fabric notebook is to use semantic-link-labs (aka sempy) and create an instance of FabricRESTClient, which uses the credentials of the logged in user to run the API
https://fabric.guru/using-fabricrestclient-to-make-fabric-rest-api-calls2) If you really want to generate an access token yourself there are 2-3 ways. Firstly you can use the msal python library
https://learn.microsoft.com/en-us/entra/msal/python/3) Secondly you can craft your token request using the azure identities libraries
https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/identity/access-tokens?tabs=windows&pivots=programming-language-python4) Lastly you can try to use the requests library (although tbh I've only ever got these working with service principals, which as you note won't kick a pipeline off.
If this helps, please Accept as a Solution to help others find it more easily.
Hi spencer_sa
Much appreciated, since I had to automate this process with scheduling notebook. Fabric Rest Client worked for me. (Apparently idk if it uses the users stored credential as for testing I closed my Fabric window and it still worked.)
The other options however cannot be automated as there will either be a login page(like msal) and import requests definitely didn't work as it is specific to service principals.
Hope this helps for anyone else looking!