Forum Discussion
Microsoft fabric notebook - to execute notebook externally using rest api
- 1 year ago
Hi shivam_dalvi,
Below is an example with C# to acquire the access token, you might be able to adapt that to Python/PySpark code in your Fabric Notebook:
Here is another example how in concept this should work:
https://stackoverflow.com/questions/75751477/how-to-get-a-microsoft-azure-authorization-token
Hope this helps to get you started?
Hi, shivam_dalvi
At the time of initial authentication, a refresh token and an access token are requested. This refresh token can be used to obtain a new access token when the current access token expires. Make sure your authentication request includes a offline_access scope to receive the refresh token. You can check the following link:
Implementing the Refresh Token Flow
You might also consider using libraries such as the Microsoft Authentication Library (MSAL), which can handle token acquisition and refresh automatically. You can refer to these links:
Continuous access evaluation in Microsoft Entra - Microsoft Entra ID | Microsoft Learn
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.