How to Create Embed Code in Power BI
Sharing your Power BI interactive reports and dashboards on a website, blog post, or internal portal is a great way to bring your data to life for a wider audience. The key to making this happen is generating an embed code. This guide will walk you through exactly how to create embed codes in Power BI for both public and secure sharing scenarios.
First, Understand Power BI Embedding: Public vs. Secure
Before you generate that code, it's essential to know the fundamental difference between the two primary embedding options Power BI offers. Choosing the wrong one can lead to security risks, so this is the most critical step.
1. Publish to Web (Public)
This method creates a public link and an embed code that anyone on the internet can access without needing to sign in to Power BI. It's meant for sharing data with a wide, public audience, like embedding a map on a news site or a data visualization on a public blog.
- Security: None. Anyone with the link can view your report. Do not use this for confidential or proprietary data. Consider the data entirely public once published this way.
- Licensing: Free. Neither you nor the viewer needs a Power BI Pro or Premium Per User (PPU) license.
- Use Case: Displaying non-sensitive data for a general audience on a public website.
2. Embed for Your Organization (Secure)
This method generates an embed code designed specifically for internal use. It securely embeds a report into an internal site, like SharePoint Online, Microsoft Teams, or a company wiki. It maintains all of your data's row-level security and permissions.
- Security: High. Viewers must sign in with their organizational account and must have the necessary permissions within Power BI to view the report.
- Licensing: Requires viewers to have a Power BI Pro or PPU license. This option is not free for consumers of the report.
- Use Case: Sharing reports and dashboards internally with colleagues on company portals or collaboration tools.
With that distinction clear, let's get into the step-by-step process for each method.
How to Create a Public Embed Code with "Publish to Web"
Use this method only when you are 100% certain the data in your report can be made public. Once you publish it, anyone can view and share it.
Follow these steps from the Power BI service (app.powerbi.com), not Power BI Desktop.
Step 1: Open Your Report
Navigate to the Power BI workspace that contains your report and open the specific report you want to embed. You must be a report owner or have edit permissions in the workspace to see the publishing option.
Step 2: Start the Publishing Process
In the top menu bar, click on File > Embed report > Publish to web (public).
Step 3: Acknowledge the Security Warning
Power BI will display a prominent warning reminding you that this will make your report data public. This is your final chance to make sure you're not about to share sensitive information. Read it, understand it, and if you are sure you want to proceed, click Create embed code.
Step 4: Publish the Code
After confirming, a final dialog will appear. Click Publish. Power BI will now generate the necessary links for you.
Step 5: Copy Your Code or Link
You'll now see a success window containing two options:
- A link you can send in email: This is a direct URL to the report that you can share.
- An HTML snippet you can paste into your blog or website: This is the iframe code. This is what you'll copy and paste into the HTML of your website where you want the report to appear.
Simply click the Copy button next to the iframe snippet. That's the code you'll use on your website.
Managing Your Public Embed Codes
If you need to review or delete a public embed code you've created, you can do so easily:
- Click the Settings icon (a gear) in the top right of the Power BI service.
- Select Manage embed codes.
- Here you will see a list of all reports you've published. You can retrieve the code again or click the ellipsis (...) to get options, including Delete, which will permanently disable the link and embed code, breaking it wherever it's been used.
How to Create a Secure Embed Code for Your Organization
This is the default and recommended way to share reports internally. It ensures only authenticated and permissioned users can see the data.
Step 1: Open Your Report in Power BI Service
Just like before, navigate to and open the report you want to securely embed.
Step 2: Generate the Secure Embed Code
Go to File > Embed report > Website or portal. This is a different option from the public method.
Step 3: Copy an iframe You Can Use
A dialog box will instantly appear with the secure iframe embed code. There is no security warning flow this time, because this option respects your existing security setup. Click the Copy button to grab the code.
That’s it. You now have a secure code you can paste into any internal web page that supports iframe embeds. Viewers will be prompted to sign in with their organizational Microsoft account if they aren't already logged in.
Using Your Embed Code: SharePoint and Beyond
The most common destination for a secure embed is SharePoint Online, where integration is seamless.
Embedding in SharePoint Online
For SharePoint, you don’t even need the full iframe code, you just need the report’s URL.
- Go to the SharePoint page where you want to add the report and switch it to Edit mode.
- Find a spot on the page, click the + icon to add a new web part, and search for the Power BI web part.
- Click Add report on the new web part.
- In the Power BI panel on the right, paste the URL of your report into the "Power BI report link" field. You can get this URL directly from your browser’s address bar when viewing the report in the Power BI service.
- The report will instantly load on the page. You can configure options like which page to show by default and the aspect ratio.
- Publish your SharePoint page to save the changes.
The process is similarly streamlined in Microsoft Teams, where you can add a "Power BI" tab directly to a channel and select your report from a list, creating a powerful, collaborative data experience without any code.
Best Practices for Embedding Power BI Reports
Keep these final points in mind to ensure a smooth and secure experience for your users.
- Double-Check Your Method: The biggest mistake is using "Publish to web" for private data. Always ask yourself, "Would I be okay with this data appearing on the front page of an online newspaper?" If the answer is no, use the secure "Website or portal" option.
- Think About Licensing: For secure embedding, remember that every single viewer needs a Power BI Pro or PPU license to see the report. This often catches teams by surprise. Ensure your intended audience is properly licensed.
- Optimize Your Report: An embedded report is still a Power BI report. If it's slow to load in the Power BI service, it will be slow to load on your website. Optimize your visuals, reduce data complexity, and write efficient measures to provide a faster loading experience.
- Test Viewer Permissions: After embedding a secure report, test it from a colleague’s account (who has viewing-level permissions) to ensure they can see it as intended.
Final Thoughts
Creating an embed code in Power BI is a reasonably simple process once you understand the critical difference between public and secure sharing. Follow the "Publish to web" method for public-facing data and the "Website or portal" method for all internal reports to maintain security and control over your business intelligence assets.
While Power BI is a powerful tool for building in-depth, complex reports, sometimes you need answers faster, without the steep learning curve. For those situations, we created Graphed. We connect directly to your marketing and sales data sources, and let you create real-time dashboards and reports just by asking questions in plain English - no technical skill required. It’s perfect for giving your whole team the ability to build and share insights in seconds, not hours.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.