Edit

Share via


Use the Microsoft Fabric data agent (preview)

Integrate your Azure AI Foundry Agent with the Microsoft Fabric data agent to unlock powerful data analysis capabilities. The Fabric data agent transforms enterprise data into conversational Q&A systems, allowing users to interact with the data through chat and uncover data-driven and actionable insights.

You need to first build and publish a Fabric data agent and then connect your Fabric data agent with the published endpoint. When a user sends a query, the will first determine if the Fabric data agent should be leveraged or not. If so, it will use the end user’s identity to generate queries over data they have access to. Lastly, the agent will generate responses based on queries returned from Fabric data agents. With Identity Passthrough (On-Behalf-Of) authorization, this integration simplifies access to enterprise data in Fabric while maintaining robust security, ensuring proper access control and enterprise-grade protection.

Usage support

Azure AI foundry support Python SDK C# SDK JavaScript SDK REST API Basic agent setup Standard agent setup
✔️ ✔️ ✔️ ✔️

Prerequisites

  • You have created and published a Fabric data agent endpoint

  • Developers and end users have at least Azure AI User RBAC role.

  • Developers and end users have at least READ access to the Fabric data agent and the underlying data sources it connects with.

  • Your Fabric Data Agent and Azure AI Foundry Agent need to be in the same tenant.

Setup

Note

  • The model you selected in Azure AI Foundry Agent setup is only used for agent orchestration and response generation. It doesn't impact which model Fabric data agent uses for NL2SQL operation.
  • To help your model invoke your Microsoft Fabric tool in the expected way, make sure you update agent instructions with descriptions of your Fabric data agent and what data it can access. An example is "for customer and product sales related data, please use the Fabric tool". We recommend using a smaller AI model such as gpt-4o-mini. You can also use tool_choice parameter in SDK or API to force Fabric tool to be invoked at each run.
  1. Create an Azure AI Foundry Agent by following the steps in the quickstart.

  2. Create and publish a Fabric data agent

    Note

    • Make sure you have published the data agent in Fabric.

You can add the Microsoft Fabric tool to an agent programmatically using the code examples listed at the top of this article, or the Azure AI Foundry portal. If you want to use the portal:

  1. Navigate to the Agents screen for your agent in Azure AI Foundry, scroll down the Setup pane on the right to knowledge. Then select Add.

    A screenshot showing the available tool categories in the Azure AI Foundry portal.

  2. Select Microsoft Fabric and follow the prompts to add the tool. You can add only one per agent.

  3. Click to add new connections. Once you have added a connection, you can directly select from existing list.

    1. To create a new connection, you need to find workspace-id and artifact-id in your published Fabric data agent endpoint. Your Fabric data agent endpoint would look like https://<environment>.fabric.microsoft.com/groups/<workspace_id>/aiskills/<artifact-id>

    2. Then, you can add both to your connection. Make sure you have checked is secret for both of them

      A screenshot showing the fabric connection in the Azure AI Foundry portal.

Follow the REST API Quickstart to set the right values for the environment variables AGENT_TOKEN, AZURE_AI_FOUNDRY_PROJECT_ENDPOINT and API_VERSION. For API_VERSION, make sure you are using 2025-05-15-preview.

Important

The following samples are applicable if you are using Azure AI Foundry Project resource with Microsoft Fabric tool through REST API call Your connection ID should be in this format: /subscriptions/<sub-id>/resourceGroups/<your-rg-name>/providers/Microsoft.CognitiveServices/accounts/<your-ai-services-name>/projects/<your-project-name>/connections/<your-fabric-connection-name>

Create an agent with the Microsoft Fabric tool enabled

curl --request POST \
  --url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "instructions": "You are a helpful agent.",
        "name": "my-agent",
        "model": "gpt-4o",
        "tools": [
          {
            "type": "fabric_dataagent",
            "fabric_dataagent": {
                "connections": [
                    {
                        "connection_id": "/subscriptions/<sub-id>/resourceGroups/<your-rg-name>/providers/Microsoft.CognitiveServices/accounts/<your-ai-services-name>/projects/<your-project-name>/connections/<your-fabric-connection-name>"
                    }
                ]
            }
          }
        ]
      }'

Create a thread

Create a thread

curl --request POST \
  --url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads?api-version=$API_VERSION \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  -H "Content-Type: application/json" \
  -d ''

Add a user question to the thread

curl --request POST \
  --url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "role": "user",
      "content": "<question related to your data>"
    }'

Create a run and check the output

Run the thread

curl --request POST \
  --url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs?api-version=$API_VERSION \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "assistant_id": "asst_abc123",
  }'

Retrieve the status of the run

curl --request GET \
  --url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/runs/run_abc123?api-version=$API_VERSION \
  -H "Authorization: Bearer $AGENT_TOKEN"

Retrieve the agent response

curl --request GET \
  --url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/threads/thread_abc123/messages?api-version=$API_VERSION \
  -H "Authorization: Bearer $AGENT_TOKEN"

Next steps

See the full sample for Fabric data agent.