DEV Community

Cover image for How to Publish a Power BI Report and Embed It on a Website
Mungai M.
Mungai M.

Posted on

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

You have built a Power BI report. The charts look sharp, the DAX measures are doing their job, and the data model is clean. Now what? The report is sitting on your local machine in a .pbix file that nobody else can see or interact with.

This article walks you through the final stretch: publishing that report to the Power BI Service and embedding it on a website. We cover two approaches. The first is Publish to web, which makes your report publicly accessible to anyone with the link. The second is the Website or portal method, which requires viewers to sign in and respects your data permissions. Both produce an interactive iframe you drop into your HTML. We will also cover workspace creation, publishing from Desktop, responsive design, URL filtering, and troubleshooting.

What you need before you start

Power BI has a few moving parts, so let us get the prerequisites out of the way:

  • Power BI Desktop installed with a finished .pbix report ready to go.
  • A Power BI account with at least a Pro or Premium Per User (PPU) license. A free license lets you publish to "My Workspace" but does not allow sharing or embedding.
  • A work or school Microsoft account. Personal Gmail or Yahoo accounts will not work for Power BI sign-in.
  • Publish to web enabled by your tenant admin. If you are on a personal Pro subscription, this is usually on by default. In corporate environments, your admin may need to flip the switch in the Admin Portal under Tenant Settings.

With those in place, let us get into it.


Step 1: Create a Workspace in the Power BI Service

A workspace is a container in the Power BI cloud where your reports, datasets, and dashboards live. Think of it as a shared folder with permissions. You could publish directly to "My Workspace" (your personal area), but creating a dedicated workspace is better practice because it lets you control who has access and keeps related content organized.

Here is how to create one:

  1. Open your browser and go to app.powerbi.com. Sign in with your organizational account.
  2. In the left sidebar, click Workspaces.
  3. Click the + New workspace button.

Creating a new workspace in the Power BI Service

A panel slides out from the right. Fill it in:

  1. Workspace name: Give it something descriptive. For this example, "Electronics Sales Reports" works.
  2. Description (optional): A short note about what this workspace contains. Useful when your organization has dozens of workspaces and someone needs to find the right one.
  3. Under Advanced, confirm the License mode is set to Pro (or Premium Per User if your organization uses PPU).
  4. Click Apply.

Workspace creation form with name and description

Your workspace is now live and empty, ready to receive reports. You will see it listed under the Workspaces section in the left sidebar from now on.

A note on workspace roles: When you create a workspace, you are automatically the Admin. You can add other users as Members, Contributors, or Viewers from the workspace settings. For embedding purposes, you only need to be an Admin or Member yourself.


Step 2: Publish Your Report from Power BI Desktop

Publishing sends your .pbix file (the report, its data model, and dataset) from your local machine up to the workspace you just created. The process is straightforward.

  1. Open your finished report in Power BI Desktop.
  2. Make sure you are signed in to your Power BI account. Check the top-right corner of the Desktop window. If it says "Sign in," click it and authenticate with your work account.
  3. Click the Publish button on the Home tab of the ribbon. It is on the far right side of the toolbar.

Publish button on the Power BI Desktop ribbon

  1. A dialog appears asking you to select a destination. You will see "My Workspace" and any workspaces you have access to. Select the workspace you just created ("Electronics Sales Reports") and click Select.

Select workspace destination dialog

  1. Power BI Desktop uploads the report and dataset to the cloud. This takes a few seconds to a minute depending on your dataset size. When it finishes, you see a "Success!" message with a link to open the report in Power BI Service.

Click that link to verify everything looks right. Your report is now live in the cloud and accessible to anyone with workspace permissions.

What if you need to update? Just make changes in Power BI Desktop and click Publish again. It will ask if you want to overwrite the existing report and dataset. Confirm, and the cloud version updates immediately.


Step 3: Generate the Public Embed Code (Publish to Web)

With the report living in the Power BI Service, you can now generate a public embed code. This creates a shareable link and an HTML iframe snippet that you can drop into any website.

Important security note: "Publish to web" makes your report publicly accessible. Anyone with the link or embed code can view it without signing in. Do not use this for confidential or sensitive data. For internal portals where authentication is required, use the "Website or portal" embed option instead, which enforces Power BI sign-in.

Here is how to generate the embed code:

  1. Open the report in the Power BI Service at app.powerbi.com. Navigate to your workspace and click on the report.
  2. Click File in the top menu bar.
  3. Hover over Embed report in the dropdown.
  4. Click Publish to web (public).

File menu showing Embed report and Publish to web options

  1. A dialog appears warning you that the report will be publicly visible. Review the warning, then click Create embed code.
  2. A second confirmation asks you to acknowledge that the data will be publicly accessible. Click Publish.
  3. The Success dialog appears with two pieces of output:
    • A shareable link you can send via email or message.
    • An HTML iframe snippet you can paste directly into a website.

Embed code dialog with iframe HTML ready to copy

  1. Choose a Size from the dropdown (the recommended sizes are 800x600 for medium or 960x596 for a widescreen 16:9 fit). You can always adjust the width and height manually later.
  2. Click Copy to grab the iframe code.

The embed code looks something like this. The src value is the unique embed URL that Power BI generates for your report (it starts with the Power BI domain followed by /view?r= and an encoded token):

<iframe
  title="Electronics Sales Report"
  width="800"
  height="600"
  src="<your-embed-url>"
  frameborder="0"
  allowFullScreen="true">
</iframe>
Enter fullscreen mode Exit fullscreen mode

That src URL is the magic. It points to a read-only, publicly accessible render of your report that Power BI hosts for you.


Step 4: Embed the Report on Your Website

This is the simplest step. You have an iframe. Any website that supports HTML can host it.

Basic HTML page

If you are building a standalone page, drop the iframe into your HTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sales Dashboard</title>
  <style>
    body {
      font-family: 'Segoe UI', sans-serif;
      margin: 0;
      padding: 2rem;
      background: #f5f6fa;
    }
    h1 {
      color: #1a1a2e;
      margin-bottom: 1rem;
    }
    .report-container {
      max-width: 1000px;
      margin: 0 auto;
    }
    iframe {
      width: 100%;
      border: none;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
  </style>
</head>
<body>
  <div class="report-container">
    <h1>Electronics Sales Dashboard</h1>
    <iframe
      title="Electronics Sales Report"
      width="960"
      height="596"
      src="<your-embed-url>"
      allowFullScreen="true">
    </iframe>
  </div>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Making it responsive

The default iframe has fixed width and height. To make it fluid on mobile and desktop, wrap it in a container with a percentage-based aspect ratio:

<style>
  .pbi-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
  }
  .pbi-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
  }
</style>

<div class="pbi-wrapper">
  <iframe
    title="Electronics Sales Report"
    src="<your-embed-url>"
    allowFullScreen="true">
  </iframe>
</div>
Enter fullscreen mode Exit fullscreen mode

This scales the report proportionally on any screen size.

WordPress, Wix, and other CMS platforms

Most website builders have a "Custom HTML" or "Embed" block. In WordPress, add a Custom HTML block in the editor and paste the iframe code. In Wix, use the Embed a Widget option under Add > Embed. The process is similar on Squarespace, Webflow, or any other platform that supports custom HTML.

Power BI report embedded and interactive on a website


Managing Your Embed Codes

Once your report is embedded and live, you might need to update or revoke access later. Power BI gives you a management interface for this.

Go to your workspace in the Power BI Service, click the Settings gear icon, and select Manage embed codes. From here you can:

  • Retrieve the embed code again if you lost it.
  • Delete the code, which immediately disables the public link and breaks any embedded iframes that use it.

You can only create one embed code per report. If you delete it and create a new one, the URL changes and you will need to update your website.

Data refresh behavior

The embedded report automatically reflects data refreshes. When you refresh the dataset in the Power BI Service (either manually or on a schedule), the cached data updates within about an hour. For reports that need near-real-time updates, keep in mind that the public embed cache refreshes periodically, not instantly.


Alternative: Embed in a Website or Portal (Secure Method)

The "Publish to web" approach above is perfect for public-facing content, but what if your report contains sensitive business data that should only be visible to authenticated users within your organization? That is where the Website or portal embed option comes in.

This method generates an iframe that requires viewers to sign in with their Power BI account before they can see the report. It respects all workspace permissions and Row-Level Security (RLS) rules, making it the right choice for internal dashboards, company intranets, and employee portals.

Prerequisites for secure embedding

  • Viewers need a Power BI Pro or Premium Per User (PPU) license, or the workspace must be assigned to a Premium capacity (so free-license users with Viewer role can access it).
  • You must have at least a Contributor role in the workspace where the report lives.
  • The report must be published to the Power BI Service (Steps 1-2 above still apply).
  • Your portal or website must support HTTPS. Secure embeds will not work on HTTP pages.

Generating the secure embed code

  1. Open the report in the Power BI Service at app.powerbi.com.
  2. Click File in the top menu bar.
  3. Hover over Embed report.
  4. This time, click Website or portal (instead of "Publish to web").

Secure embed code dialog with authentication required

  1. The Secure embed code dialog appears. It looks similar to the public embed dialog, but with one critical difference: the URL includes an autoAuth=true parameter that triggers automatic authentication.
  2. You get the same two outputs:
    • A shareable link for direct access.
    • An HTML iframe snippet for embedding.
  3. Click Copy on whichever you need.

The secure iframe code looks like this:

<iframe
  title="Electronics Sales Report"
  width="1080"
  height="760"
  src="<your-secure-embed-url>"
  frameborder="0"
  allowFullScreen="true">
</iframe>
Enter fullscreen mode Exit fullscreen mode

Notice the differences from the public embed. The secure URL uses /reportEmbed instead of /view, includes a reportId parameter with your report's unique GUID, and appends autoAuth=true to handle the sign-in flow. The full pattern looks like this: <power-bi-domain>/reportEmbed?reportId=<your-report-id>&autoAuth=true.

What the viewer experience looks like

When someone visits your website and hits the embedded report for the first time in their browser session, they see a "Sign in to view this report" prompt. After they authenticate with their organizational account, the report loads with full interactivity. Once signed in, any other embedded Power BI reports on the same site load automatically without a second prompt.

If a user does not have permission to view the report, they see an access-denied message instead. This is the security enforcement in action.

Granting access to viewers

The secure embed does not automatically give anyone access. You need to explicitly share the report or grant workspace access:

  • Workspace roles: Add users as Viewers in the workspace settings. This gives them access to everything in the workspace.
  • Direct sharing: Click the Share button on the specific report and enter user emails. This grants access to just that report.
  • Microsoft 365 Groups: If you manage access through M365 groups, add the group to the workspace membership.

Customizing the secure embed with URL parameters

One advantage of the secure embed is that you can control which page opens and pre-filter the data using URL parameters. This is useful when you have a single report but want different portal pages to show different views.

Opening a specific page:

Append &pageName=ReportSection2 to the iframe src URL, where ReportSection2 is the page identifier you can find at the end of the report's URL in the Power BI Service.

<your-secure-embed-url>&pageName=ReportSection2
Enter fullscreen mode Exit fullscreen mode

Pre-filtering data:

Append a $filter parameter to show only specific data. For example, to show only the "Computers" category:

<your-secure-embed-url>&$filter=DimProduct/Category eq 'Computers'
Enter fullscreen mode Exit fullscreen mode

You can combine page navigation and filters to build a lightweight portal experience without any custom code beyond basic HTML links or buttons.

A word of caution: URL filters are a convenience feature, not a security mechanism. Users can modify the URL in their browser to remove or change filters. If you need to enforce data visibility rules, use Row-Level Security in your data model. That way, even if someone strips the filter parameters, they still only see the rows they are authorized to access.

Enabling Copilot in secure embeds

If your organization has Copilot enabled and the workspace is on Premium or Fabric capacity, you can check the Enable Copilot box in the secure embed dialog. This lets users interact with Copilot directly inside the embedded report, asking natural language questions about the data.


Choosing the Right Embed Method

Now that we have covered both approaches in detail, here is how they compare side by side:

Method Access Authentication RLS Support Best for
Publish to web Anyone with the link None required No Public dashboards, blog posts, marketing pages
Website or portal Organizational users only Power BI sign-in required Yes Internal portals, intranets, employee dashboards
Power BI Embedded (Azure) Custom application users App-managed tokens Yes ISV products, customer-facing SaaS applications

The first two methods are covered in this article and require no coding beyond pasting an iframe. The third method (Power BI Embedded) is a developer-oriented approach that uses the Power BI JavaScript SDK and Azure Active Directory tokens for full programmatic control. It is the right choice for software vendors building analytics into their own products.

When to use which:

  • Your company blog needs a public sales trends chart? Publish to web.
  • Your HR team needs an internal headcount dashboard on the company intranet? Website or portal.
  • You are building a SaaS product and want to offer embedded analytics to your customers? Power BI Embedded.

Common Issues and Fixes

Publish to web issues

"I do not see the Publish to web option."
Your Power BI admin has likely disabled the Publish to web tenant setting. Contact your admin and ask them to enable it under Admin Portal > Tenant Settings > Export and Sharing Settings > Publish to web.

"The embed code shows a blank page."
Check that your report does not use Row-Level Security (RLS). Publish to web does not support RLS. Also confirm the embed code status is "Active" in the Manage embed codes page.

"The report looks cut off in the iframe."
Adjust the width and height values in the iframe tag. Power BI recommends adding 56 pixels to the height to accommodate the bottom toolbar. For a 16:9 layout, try 960x596 or 800x506.

"Changes I made to the report are not showing."
The public embed caches data for up to one hour. After making changes, wait for the cache to refresh, or manually refresh the dataset in the Power BI Service to force an update.

Secure embed issues

"Users are prompted to sign in repeatedly."
Due to Chromium security updates, the autoAuth mechanism may require re-authentication more often than expected. Ensure your portal uses HTTPS and that users have pop-up windows enabled. If the problem persists, consider using the Power BI Embedded SDK with the "user-owns-data" method for a smoother single sign-on experience.

"The embedded report says 'You do not have access'."
The viewer has not been granted permission to the report. Share the report with them directly (click Share on the report in the Power BI Service) or add them to the workspace as a Viewer.

"Secure embed does not show on my portal served over HTTP."
The secure embed requires HTTPS on the hosting page. Power BI will not render authenticated content inside an insecure frame. Set up an SSL certificate on your web server.

"The embed works but Copilot does not appear."
Copilot requires three things: the Enable Copilot checkbox selected in the embed dialog, an active Copilot tenant switch in admin settings, and the workspace assigned to Premium or paid Fabric capacity. If any of these are missing, Copilot will not load.


Key Takeaways

Publishing and embedding a Power BI report follows a consistent pattern: create a workspace, publish from Desktop, generate the embed code, and paste the iframe into your site. The decision point is which embed method fits your scenario.

A few things to keep in mind:

  • Pick the right method for your audience. Publish to web is genuinely public, with zero authentication. Website or portal requires sign-in and enforces permissions. Do not use the public option for sensitive data just because it is easier.
  • One embed code per report (public). Deleting it breaks all existing embeds. The secure method uses a stable report URL, so it is less fragile.
  • Responsive design matters. Wrap the iframe in a percentage-based container so it scales on mobile. The fixed-width default looks terrible on small screens.
  • Refresh behavior differs. Public embeds cache for about an hour. Secure embeds reflect data refreshes more directly since they query the live service.
  • RLS only works with secure embed. If your data model uses Row-Level Security to restrict what different users see, Publish to web will strip all RLS rules. Use the Website or portal method to keep row-level filters intact.
  • URL parameters are your friend. The secure embed supports pageName and $filter parameters, letting you build lightweight multi-view portals without custom code.

Both methods produce a fully interactive Power BI dashboard inside your website, complete with filters, slicers, and drill-through. The difference is whether your audience walks in through an open door or shows an ID at the gate.


This article is part of a Power BI learning series covering data cleaning, DAX, star schema modeling, and report publishing. The article was submitted in fulfilment of a LuxDevHQ Cohort 7 DataEngieering assignment ©adev3loper*

Top comments (0)