在安全入口網站或網站中內嵌報告Embed a report in a secure portal or website

此頁面有所助益嗎?

Power BI 中報告的新安全 [內嵌] 選項可讓使用者輕鬆、安全地在內部 Web 入口網站中內嵌報告,不論該入口網站是雲端式裝載在內部部署環境 (例如 SharePoint 2019)。The new secure Embed option for reports in Power BI enables users to easily and securely embed reports in internal web portals, whether cloud-based or hosted on-premises, such as SharePoint 2019. 以此方式內嵌的報告會尊重資料列層級安全性 (RLS) 的所有項目權限與資料安全性。Reports embedded in this way respect all item permissions and data security through row-level security (RLS). 此功能是設計來允許不使用程式碼內嵌到接受要內嵌之 URL 或 iFrame 的任何入口網站。The feature is designed to allow no-code embedding into any portal that accepts a URL or iFrame to embed.

[內嵌] 選項也支援 URL 篩選與 URL 設定。The Embed option also supports URL Filters and URL settings. [內嵌] 選項可讓您使用幾乎不需要任何程式碼的方式 (但要求您具備基本 HTML 與 JavaScript 知識) 來與入口網站整合。The Embed option allows you to integrate with portals using a low-code approach that requires basic HTML and JavaScript knowledge.

如何將 Power BI 報告內嵌到入口網站How to Embed Power BI reports into portals

  1. 您可以在 Power BI 服務之報告中的 [檔案] 功能表找到新的 [內嵌] 選項。The new Embed option is available on the File menu for reports in the Power BI service.

    [安全內嵌] 選項下拉式選項

  2. 選取 [內嵌] 選項以開啟對話方塊,此對話方塊提用來安全地內嵌報告的供連結與 iFrame。Select the Embed option to open a dialog that provides a link and an iFrame that is used to embed the report securely.

    [內嵌] 選項對話方塊

  3. 在您的 Web 入口網站內嵌您的 URL 或直接開啟 URL 之後,使用者必須通過驗證才能存取報告。After you embed your URL in your web portal, or if you open the URL directly, the user is authenticated before given access to the report. 在下面,使用者未在瀏覽器工作階段中登入 Power BI。Below, the user has not signed-in to Power BI in the browser session. 當他們按下 [登入] 時,可能必須開啟新的瀏覽器視窗或索引標籤。When they press Sign-In, a new browser window or tab may need to open. 若您沒有看到登入提示,請檢查快顯封鎖程式。Check for pop-up blockers if you don't get prompted to sign in.

    登入以檢視此報告

  4. 在使用者登入之後,報告將會開啟並顯示資料,而且允許使用者在頁面之間瀏覽及設定篩選。After the user has signed in, the report opens, showing the data and allowing users to navigate between pages and to set filters. 報告只會針對有在 Power BI 中檢視報告之權限的使用者顯示。The report is shown only to users who have permission to view the report in Power BI. 也會套用所有資料列層級安全性 (RLS) 規則。All row-level security (RLS) rules are also applied. 最後,使用者必須正確地取得授權:他們需要 Power BI Pro 授權,或報告必須位於 Power BI Premium 容量的工作區中。Lastly, the user needs to be correctly licensed – either they need a Power BI Pro license, or the report must be in a workspace that is in a Power BI Premium capacity. 使用者妹次開啟新的瀏覽器視窗時都必須登入,但只要他們登入,系統就會自動載入其他報告。The user needs to sign in each time they open a new browser window, but after they’ve signed in once other reports load automatically.

    內嵌報告

  5. 當使用 iFrame 選項時,最好編輯提供的 HTML 以指定適合您入口網站網頁的寬度與高度。When using the iFrame option, it's best to edit the HTML provided to specify the desired height and width to fit into your portal’s web page.

    設定高度與寬度

授與報表存取權Granting access to reports

[內嵌] 選項不會自動允許使用者檢視報告。The Embed option doesn't automatically permit users to view the report. 在 Power BI 服務中,具有檢視報表所需的權限。The permissions to view the report are set within the Power BI service.

若要提供對 Power BI 服務內之報告的存取權,您可以將報告與需要內嵌報告存取權的使用者共用。To provide access to the report within the Power BI service, you can share the report with the users who require access to the embedded report. 如果您使用 Office 365 群組,可以將使用者列為 Power BI 服務內的應用程式工作區成員。If you're using an Office 365 Group, you can list the user as a member of the app workspace within the Power BI service. 如需詳細資訊,請參閱如何管理應用程式工作區For more information, see how to manage an app workspace.

授權Licensing

檢視報告的使用者需要 Power BI Pro 授權,或者內容需要位於 Power BI Premium 容量 (EM 或 P SKU) 的工作區中。Users viewing the embedded report need either a Power BI Pro license or the content needs to be in a workspace that's in a Power BI Premium capacity (EM or P SKU).

使用 URL 設定自訂您的內嵌體驗Customize your embed experience using URL settings

內嵌 URL 支援數個輸入設定,這些設定可協助您自訂您的使用者體驗。The embed URL supports several input settings that help you customize your user experience. 若您使用提供的 iFrame,請確認您已在 iFrame 的來源設定中更新 URL。If you’re using the iFrame provided, make sure you update the URL in the iFrame’s src settings.

屬性Property 描述Description
pageNamepageName 您可以使用 pageName 查詢字串參數來設定要開啟報告的哪一個頁面。You can use the pageName query string parameter to set which page of the report to open. pageName 值對應到報告 URL 結尾 (當在 Power BI 服務中檢視報告時),如下所示。The pageName value corresponds to the end of the report URL when viewing a report in the Power BI service, as shown below.
URL 篩選URL Filters 您可以在接收自 Power BI UI 的內嵌 URL 中使用 URL 篩選以篩選內嵌的內容。You can use URL Filters in the embed URL you received from the Power BI UI to filter the content of the embed. 透過這種方式,只需要基本 HTML 與 JavaScript 體驗,就可以建置只需要使用少數程式碼的整合。This way you can build low-code integrations with only basic HTML and JavaScript experience.

設定當內嵌報告時要開啟的頁面Set which page opens when the report is embedded

pageName 設定中提供的值對應到報告 URL 的結尾 (當在 Power BI 服務中檢視報告時)。The value provided in the pageName setting corresponds to the end of the report URL when viewing a report in the Power BI service.

  1. 在您的網頁瀏覽器中從 Power BI 服務開啟報告,然後從網址列複製 URL。Open the report from the Power BI service in your web browser, and then copy the URL from the address bar.

    [報告] 區段

  2. pageName 設定附加到 URL。Append the pageName setting to the URL.

    附加 pageName

使用 URL 篩選來篩選報告內容Filter report content using URL filters

如需進階功能,您可以使用 URL 篩選來使用報告建置更豐富的體驗。For some advanced features, you can URL Filters to build more experiences using the report. 例如,下面的 URL 會篩選報告以顯示能源產業的資料。For example, the URL below filters the report to show data for the Energy industry.

使用 pageNameURL Filters 的組合功能強大。Using the combination of pageName and URL Filters can be powerful. 您可以使用基本 HTML 與 JavaScript 來建置體驗。You can build experiences using basic HTML and JavaScript.

例如,以下說明如何新增按鈕到 HTML 頁面:For example, here’s how you can add a button to an HTML page:

<button class="textLarge" onclick='show("ReportSection", "Energy");' style="display: inline-block;">Show Energy</button>

當按下該按鈕時,系統會呼叫函式以使用更新的 URL 來更新 iFrame,這包括能源產業的篩選。When pressed, the button calls a function to update the iFrame with an updated URL, which includes the filter for the Energy industry.

function show(pageName, filterValue)

{

var newUrl = baseUrl + "&pageName=" + pageName;

if(null != filterValue && "" != filterValue)

{

newUrl += "&$filter=Industries/Industry eq '" + filterValue + "'";

}

//Assumes there’s an iFrame on the page with id=”iFrame”

var report = document.getElementById("iFrame")

report.src = newUrl;

}

篩選

您可以視需要新增所要的按鈕數目,以建立不需要撰寫太多程式碼的自訂體驗。You can add as many buttons as you’d like to create a low-code custom experience.

考量與限制Considerations and limitations

  • Azure 企業對企業 (B2B) 不支援外部使用者。Doesn't support external guest users with Azure business to business (B2B).

  • 安全內嵌適用於發行到 Power BI 服務的報告。Secure embed works for reports published to the Power BI service.

  • 每當使用者開啟新的瀏覽器視窗時,都必須登入以檢視報告。The user needs to sign-in to view the report whenever they open a new browser window.

  • 在登入之後,某些瀏覽器會要求您重新整理頁面,特別是使用 InPrivate 或無痕模式時。Some browsers require you to refresh the page after sign-in, especially when using InPrivate or Incognito modes.

  • 為獲得單一登入體驗,請使用 [內嵌於 SharePoint Online 中] 選項,或使用使用者擁有資料方式建置自訂整合。To achieve a single sign-on experience, use the Embed in SharePoint Online option, or build a custom integration using the user owns data approach. 深入了解使用者擁有資料Learn more about user owns data.

  • 隨著 [內嵌] 選項提供的自動驗證功能無法搭配 Power BI JavaScript API 使用。The automatic authentication capability provided with the Embed option doesn't work with the Power BI JavaScript API. 針對 Power BI JavaScript API,請使用使用者擁有資料方式來內嵌。For the Power BI JavaScript API, use the user owns data approach to embedding. 深入了解使用者擁有資料Learn more about user owns data.

後續步驟Next steps