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

# Power BI

> Sync Power BI semantic model and report definitions into your migration repository.

> [!NOTE]
>
> BI Tools integrations are enabled per organization for migration projects. Ask your Datafold contact or [support@datafold.com](mailto:support@datafold.com) to turn them on.

Datafold signs in to Power BI as a Microsoft Entra ID service principal and downloads semantic model (TMDL) and report (PBIR) definitions through the Fabric REST API, without data. For what the sync does with them, see [BI Tools](https://docs.datafold.com/integrations/bi-tools.md).

## Requirements

* The workspaces to sync are on **Power BI Premium** or **Fabric** capacity. The Fabric API exports definitions only from such workspaces.
* The service principal has the **Contributor**, **Member**, or **Admin** role in each workspace to sync. Exporting a definition needs read and write access to the item.
* Datafold does **not** need Power BI admin rights or the admin API tenant settings.

## 1. Create a service principal

**1. Register an application**

In the [Microsoft Entra admin center](https://entra.microsoft.com/?l=en.en-us#view/Microsoft_AAD_RegisteredApps/CreateApplicationBlade/quickStartType~/null/isMSAApp~/false), register a new application:

* **Name**: `Datafold Power BI` (or similar)
* **Supported account types**: **Accounts in this organizational directory only**
* **Redirect URI**: leave it blank

![](https://mintcdn.com/datafold/qH5vFV99qD-5khom/images/power-bi/service-principal/register-an-application.png?fit=max\&auto=format\&n=qH5vFV99qD-5khom\&q=85\&s=e1944be09e095f08af049fcc7ee3671c)

On the application's **Overview** page, note the **Application (client) ID** and the **Directory (tenant) ID**.

**2. Create a client secret**

In the application, open **Certificates & secrets**, click **New client secret**, and choose an expiration period. Copy the secret's **Value** at once: Entra shows it only once.

![](https://mintcdn.com/datafold/qH5vFV99qD-5khom/images/power-bi/service-principal/certificates-and-secrets.png?fit=max\&auto=format\&n=qH5vFV99qD-5khom\&q=85\&s=f0f35b46b7c6d692f7737c5261412c9d)

**3. Add it to a security group**

Create a security group (for example, `Fabric API service principals`) and add the application as a member. You use this group to allow the service principal in the tenant setting below.

![](https://mintcdn.com/datafold/qH5vFV99qD-5khom/images/power-bi/service-principal/new-group.png?fit=max\&auto=format\&n=qH5vFV99qD-5khom\&q=85\&s=77ccc8b428b414d0a904d7eea4e86f24)

**4. Allow service principals to call Fabric APIs**

In the [Fabric admin portal](https://app.powerbi.com/admin-portal/tenantSettings), open **Tenant settings** → **Developer settings**. Turn on **Service principals can call Fabric public APIs**, and apply it to the security group (or to the whole organization).

**5. Add it to each workspace**

In each workspace to sync, open **Manage access** and add the application with the **Contributor** role or higher.

![](https://mintcdn.com/datafold/qH5vFV99qD-5khom/images/power-bi/service-principal/manage-access.png?fit=max\&auto=format\&n=qH5vFV99qD-5khom\&q=85\&s=25cc38c99e8da06fd3eb81caf97013fd)

## 2. Add the integration in Datafold

Go to **Settings** → **Integrations** → **BI Tools**, click **Add new integration**, and choose **Power BI**. Fill in the form:

* **Tenant ID**: the directory (tenant) ID.
* **Client ID**: the application (client) ID of the service principal.
* **Client secret**: the secret value from step 1.
* **Workspaces**: the workspaces to sync. When the credentials are filled in, click **Load workspaces** to list the workspaces that the service principal is a member of, then pick them. You can also type a workspace name or ID and press Enter. The list is required: a tenant can hold thousands of workspaces.

Then fill in the [shared settings](https://docs.datafold.com/integrations/bi-tools.md#settings-shared-by-both-tools) and save. Datafold tests the sign-in and checks that the service principal can see each workspace.

## 3. Run a sync

Click **Sync now**. When the sync finishes, open the pull request from the **Latest sync** panel, then add the [mappings](https://docs.datafold.com/integrations/bi-tools.md#settings-shared-by-both-tools) for the warehouse connections that the sync found.

## Troubleshooting

* **Service principal sign-in failed**: check the tenant ID, client ID, and secret, and that the secret has not expired.
* **The Fabric API refused the service principal**: check that the tenant setting **Service principals can call Fabric public APIs** includes the service principal's security group. Tenant setting changes can take up to 15 minutes to apply.
* **The Fabric API is not reachable from Datafold**: check that your network allows Datafold to reach `api.fabric.microsoft.com` and `api.powerbi.com`.
* **Not visible to the service principal**: add the service principal to the workspace with the **Contributor** role or higher.
* **The definition export did not finish**: the workspace may not be on Premium or Fabric capacity, or a large model took too long to export. Run the sync again.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.