Forum Discussion

SnackSeeker91's avatar
SnackSeeker91
Frequent Visitor
1 year ago
Solved

MS Fabric - Bearer Token retreaving

Hello,   Could someone explain me if is it possible to retreave Bearer token in MS Fabric notebook ? I am trying to download data from MS Planner via  "https://graph.microsoft.com/v1.0/planner/plan...
  • v-ssriganesh's avatar
    1 year ago

    Hi SnackSeeker91,
    Thank you posting your in Microsoft fabric community forum.

    The answer provided by @nilendraFabric was indeed correct. As mentioned, mssparkutils.credentials.getToken() in Microsoft Fabric notebooks does not support retrieving tokens for Microsoft Graph API directly. Instead, you’ll need to use Azure App Registration with the Client Credentials flow to get an access token, as demonstrated in the solution provided by @SuperUser.

    Additional Points to Consider:

    • Instead of hardcoding client_id and client_secret, store them securely in Azure Key Vault and retrieve them dynamically in your notebook.
    • If you're using Managed Identity in your Fabric workspace (if supported in the future), you may authenticate directly without needing to store secrets.
    • Please Ensure that your registered app in Azure AD has the correct permissions (Planner.ReadWrite.All for full access). If you face permission errors, an Azure AD admin may need to grant consent.

    If this helps, then please Accept it as a solution and dropping a "Kudos" so other members can find it more easily.
    Thank you.