Service Principal Authentication for Fabric Data Agents
Fabric Data Agents now support service principal authentication: the missing piece for taking AI-powered data agents from prototype to production without depending on user sign-in flows.
The client code in this post uses the OpenAI Assistants-style endpoint (/aiassistant/openai), and OpenAI shut down the Assistants API on August 26, 2026. Microsoft now points to each published agent's MCP endpoint instead. The service principal setup below still applies: the same token works as a bearer header on the MCP endpoint. For the new client code, see Calling a Fabric Data Agent over MCP.
Until now, every call to a Fabric Data Agent API required a delegated user token. A real person had to sign in. That works for interactive demos but breaks the moment you try to wire a data agent into a backend service, a scheduled job, or a multi-user chatbot. Service principal support changes that. Your application authenticates on its own behalf, no user sign-in required.
This feature, currently in public preview, is one of the most-requested capabilities from teams moving Fabric Data Agents into production. Here is what changed, why it matters, and how to set it up.
- 0 user sign-ins needed. Service principals authenticate with application credentials. No interactive login flow, no token pop-ups, no dependency on a human session.
- 2 key production scenarios. Direct app-to-agent calls and Microsoft Foundry agent integration: both now work with application-level identity.
- ~1h access token lifetime. Client-credentials access tokens expire after roughly 60 to 90 minutes. The OAuth 2.0 client-credentials flow requests fresh ones automatically. The client secret itself rotates on the schedule you configure.
The Problem Before
Fabric Data Agents expose a conversational API that lets applications send natural-language questions and receive grounded answers from enterprise data. But the authentication model only supported delegated user tokens: the OAuth 2.0 authorization-code flow where a real user signs in.
This blocked three patterns
- Backend services: APIs, cron jobs, and microservices that run without a browser session
- Multi-user chatbots: a single bot serving many end-users shouldn't need each user to have Fabric access
- Agent-to-agent orchestration: Foundry agents calling Fabric data agents as tools in an agentic workflow
Two Production Scenarios
Scenario 1: Custom App → Data Agent
You have built a Fabric data agent, published it, and want to call it from your own application: a web app, a backend service, a chatbot, or an internal tool. Your app authenticates with its own service principal credentials, gets a token from Entra ID, and calls the data agent API directly.
The application acts on its own behalf. End-users never need Fabric access.
Scenario 2: Foundry Agent → Data Agent
You build an agent in Microsoft Foundry and connect a Fabric data agent as a knowledge source or tool. The Foundry agent handles conversational experience and orchestration logic, while the Fabric data agent provides grounded, accurate answers from enterprise data.
The Foundry agent authenticates to the data agent via service principal, with no user pass-through needed.
Setup in Four Steps
Register an app in Microsoft Entra ID
Go to the Azure portal → App registrations → New registration. This creates the application identity your service will use.
Create a service principal and secret
The service principal is the identity object in your tenant. Generate a client secret (or certificate) that your application will use to authenticate.
Grant workspace access
Add the service principal to your Fabric workspace with the appropriate role. The data agent inherits workspace permissions, with no separate agent-level grant needed.
Authenticate and call the API
Use the OAuth 2.0 client-credentials flow to request a token from Entra ID, then call the data agent API with that bearer token.
Authentication Flow
The data agent API surface has evolved during preview. Verify the current endpoint shape against the Microsoft Learn reference before shipping.
Gotchas and Best Practices
Bootstrap the security token first
Newly created service principals must generate an initial Fabric security token via the Fabric REST API. Until you do this, you will see cryptic errors about missing files or permissions, even though the SPN has been granted access.
Enable SPN access in admin portal
The Fabric admin portal has a tenant setting that must explicitly allow service principals to call Fabric APIs. Without this toggle, all SPN calls return 403 regardless of workspace permissions.
Token refresh vs. secret rotation
Access tokens from the client-credentials flow live roughly 60 to 90 minutes. Libraries like azure-identity refresh them for you. What expires on a longer schedule is the client secret (typically months, set at creation): track it and rotate before expiry, and never rely on manual renewal.
KQL databases coming soon
Service principal support for KQL databases as a data agent source is not yet available but has been confirmed as coming soon. Plan accordingly if your agent queries Eventhouse data.
Try It Yourself: Interactive Testing Template
Before writing a single line of production code, verify your service principal configuration works. We built an open-source template that lets you test the full SPN → Data Agent flow right in your browser, with no local setup required.
Three-Step Test
- Create & publish your Data Agent in Microsoft Fabric
- Enter credentials: Tenant ID, Client ID, Client Secret, and Data Agent API URL
- Hit Test Connection: query your data agent with natural language, live
The template uses the official Fabric Data Agent REST API with the client-credentials flow. Conversation memory is retained across turns so you can explore multi-step questions. It generates drop-in embed code you can copy straight into your app.
Perfect For
- Validating SPN config before writing production code
- Learning the authentication flow hands-on
- Demoing data agent capabilities to stakeholders
- Rapid proof-of-concept without local environment setup
Testing only: use a throwaway service principal
This form takes a client secret in the browser, which is exactly what production code must never do. Use a development service principal scoped to a non-production workspace, and rotate or delete the secret as soon as you finish testing. Never paste production credentials here. In a real application the secret stays on your backend. See embedding a Data Agent in your own app for the proxy pattern.
Why This Matters for Enterprise Teams
Service principal auth unlocks the governance model enterprises need. Application-level identities are auditable, manageable by security teams, and don't expose user credentials in backend services. Combined with workspace-level permissions inheritance, you get fine-grained access control without a separate permission layer for each data agent.
This also plays into the broader Agentic Fabric vision, where MCP servers, deployment pipelines, and job schedulers all authenticate via service principal. The data agent support is one piece of a larger shift toward headless, automated Fabric workflows.
Further Reading
- Service Principal Support for Data Agents in Fabric (Preview): Official announcement with full walkthrough
- Service Principals in Fabric Data Warehouse: Microsoft Learn documentation
- Agentic Fabric: How MCP is Turning Your Data Platform Into an AI-Native OS: Broader vision for headless Fabric workflows
- Fabric March 2026 Feature Summary: CLI deploy + SPN + GitHub OIDC for zero-touch pipelines