DEV Community

Collins Ochola
Collins Ochola

Posted on

How to Publish a Power BI Report and Embed It on a Website Using iFrames

This guide walks you through the complete process: from creating a workspace in Power BI Service, to publishing your report, generating the appropriate embed code, and finally embedding it into a website using an iFrame. We’ll also cover critical security considerations so you can choose the right sharing method for your specific use case.

Understanding Your Publishing and Embedding Options
Before diving into the step-by-step instructions, it’s crucial to understand that Power BI offers different embedding methods for different scenarios. Choosing the wrong option can either expose sensitive data or prevent legitimate users from accessing your reports.

Methods:

  1. Publish to Web (Public)-Anyone with the link can view
  2. Secure Embed (Website or portal)-Only Authenticated Power BI users
  3. SharePoint Online-Only Authenticated Power BI users
  4. Power BI Embedded-Any app user (no Power BI license needed)

To Note
Only Use Publish to web option when your data don't contain any sensitive information

Prerequisites
Before starting, ensure you have:

A completed Power BI report saved locally as a .pbix file

Power BI Desktop installed (free from Microsoft Store)

A work or school Microsoft account (personal accounts like @gmail.com or @outlook.com will not work for publishing to Power BI Service)

Appropriate permissions from your Power BI administrator (especially for “Publish to web” if that’s your chosen method)

How to Create a Workspace:
Open your web browser and navigate to app.powerbi.com

Sign in with your Microsoft work or school credentials

In the left navigation pane, click Workspaces

Click the + New workspace button (usually found at the bottom of the workspace list)

Fill in the workspace details:

Name: Use a clear, descriptive name (e.g., “Sales Analytics – Q1 2026”)

Description: Optional but helpful for team members

Advanced options: Configure license mode and access settings as needed

Click Apply or Save

Publish Your Report from Power BI Desktop
Once your workspace is ready, you can upload your report from Power BI Desktop.

Publishing Steps:
Open your report in Power BI Desktop

Save your file (Ctrl+S) to ensure all recent changes are captured

Look for the Sign in button on the top-right corner of the ribbon. Sign in with your Microsoft work or school account

On the Home ribbon, click the Publish button

![Power BI Desktop Home ribbon with Publish button highlighted]

A dialog box will appear showing available workspaces. Select the workspace you just created (or an existing one you have permission to use)

Click Select

Power BI will upload your file. This usually takes 30 seconds to a few minutes, depending on file size and model complexity

Once complete, you’ll see a success dialog with a link that says “Open ‘your-report-name.pbix’ in Power BI” – click this link to go directly to your published report in Power BI Service
Success confirmation dialog showing that the report has been published with a link to open in Power BI


After Publishing:
Navigate to your workspace in Power BI Service (app.powerbi.com). You should see three items:

The Report – your visualizations

The Dataset – your data model and calculated columns/measures

A Dashboard (optional) – if you created one

Click on the report name to open it. Test all interactions—slicers, drill-throughs, and page navigation—to ensure everything works as expected. Occasionally, embedded images may not upload correctly and need to be re-added directly in the Service .

Generate the Embed Code
Now that your report lives in the cloud, you can generate the code snippet needed to embed it. The steps differ slightly depending on which embedding method you need.
alt text

Publish to Web (Public Embedding) – For Public Data Only
⚠️ Important Warning: This method makes your report and all underlying data publicly accessible to anyone on the internet. Search engines can index it, and there is no authentication required. Never use this for confidential or sensitive information .

Only proceed if you are certain your data is appropriate for public sharing.

Steps:
Open your report in Power BI Service

From the top menu bar, click File → Embed report → Publish to web (public)

A warning dialog will appear explaining that anyone on the internet can view your report. Read it carefully

If you agree, click Create embed code

A second confirmation dialog appears. Click Publish

In the success dialog, you’ll see two options:

Link: A direct URL to view the report in full browser

HTML iFrame code: The embed code to paste into your website

[Publish to web success dialog showing the iFrame embed code and link options]

Top comments (0)