Forum Discussion

AshwithBhatt's avatar
AshwithBhatt
New Member
1 year ago
Solved

Azure AI Foundry with Fabric Data Agent using Managed Identity

I’m configuring the Fabric Data Agent for my project using Azure AI Foundry, where the Fabric Data Agent is set up as a Knowledge Base. I’ve built a custom frontend that connects to Azure AI Foundry through an Azure Function App acting as the API. When I log in directly to AI Foundry, I can successfully retrieve results from the Fabric Data Agent. However, when the Function App tries to do the same, it throws an error stating it cannot access the database. Is there any workaround for this issue? Do Fabric Data Agent support Service Principles?

  • Hi AshwithBhatt

     

    You’re running into an auth mismatch.

    When you test the Fabric Data Agent inside Fabric/Azure AI Foundry, it runs under your user identity and can read whatever your Entra user can read. But when your Azure Function calls the Azure AI Foundry Agents API, it’s using the Function’s managed identity (or an app identity), which isn’t a user. The Fabric tool in Azure AI Foundry is designed to use the end user’s identity via On-Behalf-Of (identity passthrough), so a headless call from MI/SPN typically fails with “can’t access the database.” See: “Use the Microsoft Fabric data agent (preview)” (the tool “uses the end user’s identity” and supports identity passthrough), and “Create a Fabric data agent (preview)” (data access “runs under your Microsoft Entra ID user identity”; SPN automation is a separate scenario and not covered).

    Suggestion:
    Switch to a delegated/OBO flow.

    Have your frontend sign in the user (MSAL). Send the user’s token to your Function, and use an On-Behalf-Of exchange to call the Azure AI Foundry Agents API. This lets the Fabric tool query as that user, honoring their Fabric permissions. Docs: AI Foundry + Fabric tool with identity passthrough.

     

    If you must use a non-interactive identity (MI/SPN):
    Today, that’s not how the Fabric tool is meant to be consumed; it expects a user identity. Community thread confirms MI/SPN for this path isn’t supported yet: community post.
    Workaround is to skip Data Agent and call Fabric sources directly with an SPN where supported (e.g., Fabric Data Warehouse has SPN support: announcement, docs).

     

    If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, please mark this as the solution.

  • lbendlin's avatar
    lbendlin
    1 year ago

    You could also consider using one of the MCP servers.  Auditing limitations will apply.

5 Replies

  • Hi AshwithBhatt

     

    You’re running into an auth mismatch.

    When you test the Fabric Data Agent inside Fabric/Azure AI Foundry, it runs under your user identity and can read whatever your Entra user can read. But when your Azure Function calls the Azure AI Foundry Agents API, it’s using the Function’s managed identity (or an app identity), which isn’t a user. The Fabric tool in Azure AI Foundry is designed to use the end user’s identity via On-Behalf-Of (identity passthrough), so a headless call from MI/SPN typically fails with “can’t access the database.” See: “Use the Microsoft Fabric data agent (preview)” (the tool “uses the end user’s identity” and supports identity passthrough), and “Create a Fabric data agent (preview)” (data access “runs under your Microsoft Entra ID user identity”; SPN automation is a separate scenario and not covered).

    Suggestion:
    Switch to a delegated/OBO flow.

    Have your frontend sign in the user (MSAL). Send the user’s token to your Function, and use an On-Behalf-Of exchange to call the Azure AI Foundry Agents API. This lets the Fabric tool query as that user, honoring their Fabric permissions. Docs: AI Foundry + Fabric tool with identity passthrough.

     

    If you must use a non-interactive identity (MI/SPN):
    Today, that’s not how the Fabric tool is meant to be consumed; it expects a user identity. Community thread confirms MI/SPN for this path isn’t supported yet: community post.
    Workaround is to skip Data Agent and call Fabric sources directly with an SPN where supported (e.g., Fabric Data Warehouse has SPN support: announcement, docs).

     

    If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, please mark this as the solution.

    • lbendlin's avatar
      lbendlin
      Icon for Super User rankSuper User

      You could also consider using one of the MCP servers.  Auditing limitations will apply.

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi AshwithBhatt ,

    We’d like to follow up regarding the recent concern. Kindly confirm whether the issue has been resolved, or if further assistance is still required. We are available to support you and are committed to helping you reach a resolution.

    Best Regards,
    Chaithra E.

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi AshwithBhatt ,

    May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.

    Thank you.