Connect your app to Power BI
You can connect your Lovable app to Power BI to use the same data and calculations your reports already have. This lets your app show consistent numbers from your Power BI semantic models.
Anyone building an app who needs to display data that is already managed and defined in Power BI reports.
Do this, in order
- 1
Decide if you want to connect using a 'Service principal' (for shared dashboards where everyone sees the same data) or a 'Signed-in user' (for models with security rules or when each user needs to see their own data).
This choice determines how your app accesses Power BI data and what security rules apply.
- 2
Go to the Microsoft Entra admin center and register a new application, or use an existing one.
This creates the identity your Lovable app will use to communicate with Power BI.
- 3
Note down the 'Directory (tenant) ID' and 'Application (client) ID' from your app registration's overview page.
These IDs are unique identifiers needed to configure the connection in Lovable.
- 4
Create a new client secret for your app registration and immediately copy its 'value'.
This secret acts like a password for your app to authenticate with Microsoft Entra; it's shown only once.
- 5
If connecting as a 'Signed-in user', add the Lovable redirect URI (`https://api.lovable.dev/workspaces/connectors/standard/oauth/callback`) to your app registration's authentication settings under 'Web' platform.
This tells Microsoft Entra where to send the user back after they successfully sign in.
- 6
If connecting as a 'Signed-in user', add 'Dataset.Read.All' and 'Workspace.Read.All' delegated permissions for the Power BI Service to your app registration.
These permissions allow your app to read Power BI datasets and workspaces on behalf of the signed-in user.
- 7
Ask your Fabric admin to enable the 'Semantic Model Execute Queries REST API' tenant setting and, if connecting as a 'Service principal', also enable 'Service principals can call Fabric public APIs'.
These settings are crucial permissions within Power BI that allow external applications, like Lovable, to query your data.
- 8
Add your app registration (by its display name) to the Power BI workspace containing the semantic models you want to query, assigning it the 'Member' role.
This grants your app the necessary access to the specific Power BI workspace and its data.
- 9
Optionally, copy the ID of a specific semantic model from its URL in the Power BI service.
This allows you to set a default model for your Lovable connection, though your app can still switch models.
- 10
In Lovable, go to 'Connectors', select 'Power BI', and click 'Add connection'.
This starts the process of setting up the connection within your Lovable project.
- 11
Give your connection a descriptive name, choose 'Use your own credentials' (for Service principal) or 'Use your own OAuth app' (for Signed-in user), and enter the IDs and secret you copied earlier.
This configures the connection in Lovable with the authentication details you set up in Microsoft Entra.
- 12
Decide who in your Lovable workspace can use this connection and then click 'Connect'.
This controls access to the Power BI data through this connection within your Lovable projects.
Paste this into your project
I need to connect my Lovable app to Power BI. I have already set up a Microsoft Entra app registration and configured the necessary permissions and workspace access in Power BI. I want to use the 'Service principal' connection method. Here are my details: - Microsoft Entra Tenant ID: [Your Tenant ID] - Service Principal Client ID: [Your Client ID] - Client Secret: [Your Client Secret] - Default semantic model ID (optional): [Your Semantic Model ID, or leave blank] Please set up the Power BI connection in Lovable for me.
Words decoded
- Power BI
- A Microsoft tool for creating reports and dashboards that show business data.
- Semantic models (datasets)
- The organized collections of data and calculations that sit behind Power BI reports, ensuring consistent numbers.
- DAX (Data Analysis Expressions)
- A formula language used in Power BI to define custom calculations and queries on your data.
- Service principal
- A non-person identity (like a robot account) that your app uses to access resources, suitable when everyone needs to see the same data.
- Microsoft Entra app registration
- A record in Microsoft's identity system that allows your application to securely access Microsoft services like Power BI.
- Client secret
- A secret key or password that your application uses to prove its identity to Microsoft's systems.
- Row-level security (RLS)
- A Power BI feature that restricts what data rows a user can see based on their identity or role.
- Build permission
- A Power BI permission that allows a user or service to connect to and query a semantic model directly.
- Microsoft Fabric
- Microsoft's all-in-one analytics platform, which includes Power BI capabilities.
- Tenant setting
- A global setting within your organization's Microsoft Fabric or Power BI environment that an administrator controls.
- OAuth app
- An application that uses a standard method (OAuth) for users to securely grant access to their data without sharing their password.
Where people get stuck
- Forgetting to copy the client secret value immediately after creation, as it's only shown once.
- Not enabling the necessary tenant settings in Power BI (like 'Semantic Model Execute Queries REST API' or 'Service principals can call Fabric public APIs'), which will prevent any queries from working.
- Using a service principal for models with row-level security or single sign-on, as it will likely fail.
- Not granting the app registration (or the service principal) the correct permissions or workspace access in Power BI.
- Allowing the client secret to expire without updating it in Lovable, which will break the connection.
- Confusing the 'Service principals can call Fabric public APIs' setting with 'Service principals can create workspaces, connections, and deployment pipelines'.
The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.