> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lovable.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your app to Microsoft Fabric

> Connect your app to Microsoft Fabric to query Lakehouses, Warehouses, SQL databases, and KQL databases, including mirrored databases, through Fabric's API for GraphQL.

export const connector_0 = "Microsoft Fabric"

[Microsoft Fabric](https://www.microsoft.com/microsoft-fabric) is Microsoft's unified data platform for Lakehouses, Warehouses, SQL databases, and real-time analytics. The Microsoft Fabric connector puts one GraphQL endpoint in front of everything you have wired into a Fabric **API for GraphQL** item, whether the data lives in a Lakehouse, a Warehouse, a SQL database, or a mirror of Snowflake.

Microsoft Fabric is available as an [app + chat connector](/integrations/app-connectors): one shared connection that works in the chat while you build and in your published apps.

With Microsoft Fabric, your app can:

* Query data across Fabric Lakehouses, Warehouses, and SQL databases through a single GraphQL endpoint
* Query mirrored databases (Azure SQL, Cosmos DB, Snowflake, Databricks) without managing per-source drivers
* Create, update, and delete rows in SQL database tables and views, and invoke stored procedures, via GraphQL mutations
* Fetch related data in one request through configured one-to-one, one-to-many, and many-to-many relationships

Authentication uses a Microsoft Entra service principal. Your credentials are stored securely in Lovable's gateway and are never exposed to the browser or your app's frontend code.

## Common use cases and example apps

| Example app                      | Example prompt                                                                                                                                        | Description                                                                                                                                                                   |
| :------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Warehouse ops dashboard**      | *Use Microsoft Fabric and build an operations dashboard that queries our Warehouse for daily orders, fulfillment status, and inventory levels.*       | **Put a live view on top of your Warehouse data.**<br />The app queries the Warehouse through GraphQL and keeps metrics current without manual exports.                       |
| **Internal CRUD tool**           | *Use Microsoft Fabric and build an internal tool where the support team can look up, create, and update customer records in our Fabric SQL database.* | **Manage operational records without handing out database access.**<br />The app reads and writes rows in the Fabric SQL database through GraphQL queries and mutations.      |
| **Cross-source account view**    | *Use Microsoft Fabric and build an app that joins mirrored Snowflake revenue data with product tables from our Lakehouse.*                            | **Combine mirrored and native Fabric data in one app.**<br />The app fetches both sources through the same GraphQL endpoint, with no per-source drivers or extra connections. |
| **KQL telemetry viewer**         | *Use Microsoft Fabric and build a telemetry viewer that reads recent events from our KQL database and charts error rates by service.*                 | **Give the team a read-only window into real-time telemetry.**<br />The app queries the KQL database through the API for GraphQL item and renders the results as charts.      |
| **Stored-procedure order entry** | *Use Microsoft Fabric and build an order entry form that submits each order through our RegisterOrder stored procedure in the Warehouse.*             | **Route writes through server-side logic.**<br />The app calls the stored procedure as a GraphQL mutation, so validation and generated IDs stay in the database.              |

## How Microsoft Fabric connections work

The connector talks to a single [API for GraphQL](https://learn.microsoft.com/en-us/fabric/data-engineering/api-graphql-overview) item in your Fabric workspace. The tables, views, and relationships you add to that item become GraphQL types your app can query, so creating the item and adding your data to it is a prerequisite.

Authentication uses **OAuth2 client credentials** with a Microsoft Entra service principal. Lovable exchanges the service principal's credentials for a Fabric token with the scope `https://api.fabric.microsoft.com/.default`, so the connection can do exactly what the service principal has been granted in Fabric, nothing more.

### What this means for data access

The service principal's permissions determine what data is available to everyone who uses the connection. There is no per-user Microsoft login: every app and builder on the connection queries Fabric as the same principal. To segment access, create separate service principals or separate API for GraphQL items, each with its own Lovable connection.

Microsoft Fabric uses Lovable's gateway architecture for secure credential handling and automatic token refresh. See [Gateway-based connectors](/integrations/app-connectors#gateway-based-connectors) for details on authentication and usage limits.

<Note>
  All queries made through this connector run against your own Microsoft Fabric environment using your service principal. Fabric usage, quotas, and billing are handled directly by **Microsoft**, not by Lovable.
</Note>

## How to connect Microsoft Fabric

Who can create Microsoft Fabric connections depends on your plan and workspace settings. App + chat connectors are available by default on Free, Pro, and Business plans. On Enterprise plans, they are effectively disabled at first: [Who can create connections and clients](/integrations/admin-controls#who-can-create-connections-and-clients) defaults to **No one** until an admin changes it in **Connectors → Admin settings → App + chat connectors**.

### Prerequisites

Before connecting, make sure you have:

* A Microsoft Fabric workspace with an **API for GraphQL** item, with the Lakehouse, Warehouse, SQL database, or KQL database data you want to use added to it
* A Microsoft Entra service principal and a client secret for it
* A Fabric tenant admin who can enable **Service principals can use Fabric APIs**, if it is not already enabled
* **Introspection enabled** on the API for GraphQL item (a Fabric workspace admin can enable it)
* Permission to **create connections** in your Lovable workspace (see [Who can create connections and clients](/integrations/admin-controls#who-can-create-connections-and-clients))

### Step 1: Set up Microsoft Entra and Fabric

Step 1 has two parts: create a service principal in Microsoft Entra, then prepare the API for GraphQL item in Fabric. Your app cannot connect until both are complete.

#### Create a service principal in Microsoft Entra

<Steps>
  <Step title="Register an application">
    Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/) and register a new application, or reuse one you already have. See Microsoft's guide: [Create a Microsoft Entra application and service principal](https://learn.microsoft.com/en-us/entra/identity-platform/howto-create-service-principal-portal).
  </Step>

  <Step title="Note the tenant and client IDs">
    On the app's **Overview** page, copy the **Directory (tenant) ID** and the **Application (client) ID**. You enter both in Lovable in Step 2.
  </Step>

  <Step title="Create a client secret">
    Go to **Certificates & secrets → New client secret** and copy the secret **value** right away; Microsoft shows it only once. The value functions like a password, so store it securely. Note the expiry date you choose: when the secret expires, the connection stops working until you create a new secret and update the connection in Lovable.
  </Step>
</Steps>

#### Prepare the API for GraphQL item in Fabric

<Steps>
  <Step title="Allow service principals to use Fabric APIs">
    Ask a Fabric tenant admin to open the **Admin portal → Tenant settings → Developer settings** and enable **Service principals can use Fabric APIs** for your app or for a security group that contains it. Without this setting, Fabric rejects every request from the service principal.
  </Step>

  <Step title="Create or open the API for GraphQL item">
    In your Fabric workspace, create an **API for GraphQL** item, or open an existing one, and add the Lakehouse, Warehouse, SQL database, or KQL database data your app needs. Only data added to this item is queryable through the connector.
  </Step>

  <Step title="Grant the service principal access">
    Share the API for GraphQL item with the service principal and grant it **Run Queries and Mutations**. If the API connects to its data source with single sign-on (SSO) connectivity, also grant the principal read access on the underlying data source, or write access if your app will run mutations.
  </Step>

  <Step title="Enable introspection">
    In the API for GraphQL item, go to **API settings → Introspection** (the gear icon in the item's top menu), enable it, and confirm. Only a Fabric workspace admin can change this setting.

    <Warning>
      Fabric ships with introspection turned off, and this connector does not work without it. Lovable verifies every new connection by running a GraphQL introspection query, and the Lovable agent relies on introspection to discover your schema while it builds. If introspection stays off, the connection fails the moment you click **Connect**.
    </Warning>
  </Step>

  <Step title="Copy the endpoint URL">
    In the API for GraphQL item, copy the public GraphQL endpoint URL. It looks like `https://api.fabric.microsoft.com/v1/workspaces/<workspace-id>/graphqlapis/<api-id>/graphql` and always ends in `/graphql`.
  </Step>
</Steps>

### Step 2: Connect Microsoft Fabric to Lovable

<Steps>
  <Step title="Open Microsoft Fabric in Connectors">
    Open [**Connectors**](https://lovable.dev/dashboard?connectors) and select **Microsoft Fabric**. For the other places to open the catalog from, see [Where to find connectors](/integrations/introduction#where-to-find-connectors).
  </Step>

  <Step title="Add a connection">
    Click **Add connection**.
  </Step>

  <Step title="Name the connection">
    In **Display name**, enter a name that identifies this connection in Lovable (for example, `Fabric Analytics`).
  </Step>

  <Step title="Enter your credentials">
    * **Microsoft Entra Tenant ID**: the Directory (tenant) ID from your Microsoft Entra tenant
    * **Service Principal Client ID**: the Application (client) ID of the service principal
    * **Client Secret**: the client secret value you generated for the service principal
    * **Fabric GraphQL Endpoint**: the full URL you copied from the API for GraphQL item, for example `https://api.fabric.microsoft.com/v1/workspaces/<workspace-id>/graphqlapis/<api-id>/graphql`. The URL must end in `/graphql`.
  </Step>

  <Step title="Choose who can use this connection">
    Under **Who can use this connection**, decide who in your workspace can use the connection:

    * **Only you** (default): only the person creating the connection can use it and its associated data.
    * **Invite specific people**: only you and explicitly added workspace members can use the connection and its associated data.
    * **Invite entire workspace**: click **Invite entire workspace** to make the connection available to everyone in your Lovable workspace.

    See [Who can use connections and clients](/integrations/admin-controls#who-can-use-connections-and-clients) for more information.
  </Step>

  <Step title="Connect">
    Click **Connect**. Lovable tests the connection immediately by running a GraphQL introspection query against your endpoint. If the test fails, the cause is almost always a skipped item in Step 1; see [Troubleshooting](#troubleshooting).
  </Step>
</Steps>

When connected, you can [link the connection to the projects](/integrations/app-connectors#link-a-connection-to-a-project) where you want to use it, and start building apps that query your Fabric data.

## Limitations

* **GraphQL API only.** The connector calls your API for GraphQL item and nothing else: no Fabric REST API, no direct SQL or KQL endpoints, no OneLake file access. A table your app needs must be added to the API item first.
* **Writes work on SQL stores only.** Create, update, delete, and stored procedure calls work against Fabric Warehouses, Fabric SQL databases, and Azure SQL databases. Lakehouses, KQL databases, and all mirrored sources are read-only.
* **The schema is what the API item owner exposed.** Your app sees the tables, views, and relationships added to the API for GraphQL item, with the permissions granted to the service principal, and nothing more.
* **Platform ceilings.** Fabric returns at most 100,000 rows per query across all pages, caps responses at 64 MB, and times out requests after 100 seconds.
* **No per-end-user Microsoft login.** Everything built on a connection queries Fabric through the same shared service principal. Create separate connections with separate service principals to segment access.

## Troubleshooting

Lovable verifies every Microsoft Fabric connection the moment you click **Connect**, so failures surface immediately and trace back to configuration in Fabric or Microsoft Entra. These are the most common:

<AccordionGroup>
  <Accordion title="The connection fails immediately after clicking Connect">
    The most common cause is introspection. Lovable verifies each new connection with a GraphQL introspection query, and Fabric ships with introspection disabled, so an untouched API for GraphQL item fails this test every time. The error message mentions that introspection is disabled.

    A Fabric workspace admin must open the API for GraphQL item, go to **API settings → Introspection**, enable it, and confirm. Then save the connection again in Lovable.
  </Accordion>

  <Accordion title="Microsoft Fabric rejected the service principal (HTTP 401 or 403)">
    Fabric is refusing requests from the service principal. Ask a Fabric tenant admin to enable **Service principals can use Fabric APIs** for the app or a security group that contains it, and make sure the principal has been granted **Run Queries and Mutations** on the API for GraphQL item.
  </Accordion>

  <Accordion title="The connection test returns an empty response">
    The service principal reaches the API but gets no data back. Grant it **Run Queries and Mutations** on the API for GraphQL item, and if the API connects to its data source with single sign-on (SSO) connectivity, also grant the principal read or write access on the underlying data source.
  </Accordion>

  <Accordion title="Microsoft Fabric could not find the GraphQL endpoint (HTTP 404)">
    The endpoint URL was not copied correctly. Copy it again from the API for GraphQL item in Fabric and make sure it ends with `/graphql`.
  </Accordion>
</AccordionGroup>

## Manage your {connector_0} connection

Connections are managed from [**Connectors**](https://lovable.dev/dashboard?connectors): select **{connector_0}**, then open the connection.

* **Unlink projects** to remove {connector_0} access from specific projects while keeping the connection available for others. See [Unlink projects from a connection](/integrations/app-connectors#unlink-projects-from-a-connection) for the steps.
* **Delete the connection** to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use {connector_0} stop working until a new connection is added. See [Delete a connection](/integrations/app-connectors#delete-a-connection) for the steps and who can delete.
