Announcement
Power BI Reports are finally here! Sponsored by Anisoptera.io and developed by Genstate.com, the Power BI Embedded plugin allows Bubble.io developers to embed Power BI reports into their applications. This plugin is intended for applications to host their Power BI reports through a Bubble interface.
The plugin is a faithful thin wrapper around the Power BI REST API and the Power BI JavaScript Client; implementing Microsoft’s development guidelines and recommended best practices for securely embedding Power BI components in web applications. For security, the plugin supports the App Owns Data
Azure AD Service Principal authentication use case, and optional inclusion of Row Level Security Identities in token generation.
The Power BI Report element is designed to support both immediate embedding through the Embed
action, and phased loading through the combination of Load
and Render
actions, with the Loaded
and Rendered
events. Phased loading is particularly useful when you need to filter the data before it is displayed.
Road Map
The plugin contains a sufficiently rich set of features to get an enterprise application in Bubble launched. As our user base grows we will be looking to extend this plugin along three different lines:
- A richer set of plugin elements to support all the types of visualization embeddings available from Power BI, such as authoring, dashboards, etc…
- Deeper REST API integration to be able to list and query reports, workspaces, datatsets, etc…
- More flexible configuration and workflow integration of element actions, states, properties, and events.
Instructions
- In the Plugins tab, add the plugin to your application.
- In the Power BI plugin, enter the keys in the environment variables.
- In the Design tab, add the Power BI Report element to your page.
- In the Workflow tab, add the element’s Initialized event.
- In the event, add the Get Report server-side action passing a Report Identifier. IMPORTANT: Remember to save the Dataset Identifier in a local custom state for use in later token requests.
- In the event, add the Get Token server-side action, passing the Report Identifier and the Dataset Identifier.
- In the event, add the element’s Embed action passing the Embed URL, Token, Report Identifier, Dataset Identifier, and calculated token renewal time.
- In the Workflow tab, add the element’s Expiring event.
- In the event, add the Get Token server-side action, passing the Report Identifier and the Dataset Identifier.
- In the event, add the element’s Update Token action passing the new Token and the calculated renewal time.
Plugin Keys
-
Azure Tenant
- Unique identifier of the Azure account tenant. -
Azure Client
- Unique identifier of the Azure client or application within the account tenant. -
Azure Secret
- confidential and private secret of the specific client or application -
Azure Authority
- URL of the authority providing credentialing services. IMPORTANT: Trim any trailing backslashes. -
Azure Scopes
- A comma delimited list of URLs that are within the scope of granted privileges. IMPORTANT: Trim any trailing backslashes. -
Power BI Endpoint
- Base URL of the Power BI API endpoint for constructing REST requests. IMPORTANT: Trim any trailing backslashes.
Element Actions
-
Embed
- Single step display of a PowerBI report; the same as callingLoad
, thenRender
. -
Load
- First step in phased display of a Power BI report, loads the provided URL to the page without displaying. -
Reset
- Full reset of the entire element; as if the element has just been created. -
Refresh
- Refreshes data sources for the report. -
Reload
- Reloads embedded report using existing configuration. E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state. -
Remove Filters
- Removes all filters at the report level. -
Render
- Render a preloaded report, using phased embedding API. -
Reset Filters
- Reset user’s filters, slicers, and other data view changes to the default state of the report. -
Update Token
- Set the accessToken. -
Add Text Filter
- Update the filters at the report level according to the operation: Add only. -
Add Number Filter
- Update the filters at the report level according to the operation: Add only. -
Add Boolean Filter
- Update the filters at the report level according to the operation: Add only.
Element Events
-
Initialized
- Element initialization was run. Use embed or load and render to activate. -
Loaded
- The loaded event is raised when the report initializes. Loading is complete when the Power BI logo disappears. -
Rendered
- The rendered event is raised when a report is fully rendered. For example, if all visuals are rendered upon loading a report or after a user interaction. -
Error
- An error event is emitted to describe a failed operation. -
Expiring
- The access token will expire. -
Hyperlink Click
- The dataHyperlinkClicked event is raised when a hyperlink is clicked, and the hyperlink’s behavior is set to NavigateAndRaiseEvent or RaiseEvent. -
Reset
- Element was reset. Use embed or load and render to activate.
Element States
-
Initialized
- Element initialization was run. -
Error Message
- A general message that describes the operation that failed (example: “Could not set page”). -
Error Description
- Detailed message that describes the error. -
Error Code
- Short message that describes the error. -
Error Identifier
- Id for debugging - should be provided when reporting a bug. -
Hyperlink Destination
- URL destination of the clicked hyperlink.
Server-Side Actions
-
Get Report
- Calls the Get Report REST API endpoint. Requires a report identifier and optionally a workspace identifier. Returns the report web URL and embedding URL along with the dataset identifier. -
Get Token
- Calls the Generate Token REST API endpoint. Requires a report identifier and a dataset identifier, optionally supports a workspace identifier and a token lifetime in minutes. Returns the token and the time of expiration.
Hints
- Calculate the token renewal time in seconds using
expiration - current time: formatted as seconds - 300
. Microsoft recommends renewing tokens 5 (300 s) to 10 (600 s) minutes before expiry. - To wrap a single string in a list use the
Split by
operator and specify a delimiter that is NOT found in the string. - All the usual provisos apply for handling responses from third party services. The Bubble developer needs to consider cases where either Azure or Power BI servers return invalid or unusable responses, particularly when requesting Tokens and secure report URLs.
Notes
- Only
App Owns Data
Azure AD Service Principal authentication is supported. - Only
Report
embedding is supported. -
Master
andMobile
layout are supported. However, Mobile layout is currently still being tested. - Only
Basic
table-column value filtering is supported. - Only the default save dialog is supported.
- Only view mode is supported. Report editing and creation is not supported.
- For best responsive display we recommend resizing the report with the display by NOT enabling
fit to content
.