內嵌 Power BI 儀表板、報表和磚Embed your Power BI dashboards, reports and tiles

了解您在應用程式中內嵌 Power BI 內容時必須採取的步驟。Learn about the steps you need to take to embed Power BI content within your application.

Microsoft 宣佈 Power BI Premium,這是一種新容量授權模型,可提高使用者如何存取、共用和散發內容的彈性。Microsoft announced Power BI Premium, a new capacity-based licensing model that increases flexibility for how users access, share and distribute content. 此供應項目也會提供 Power BI 服務的額外延展性和效能。The offering also delivers additional scalability and performance to the Power BI service. 此外也宣佈 Power BI Embedded,可讓您在 Microsoft Azure 中建立容量。Power BI Embedded was also announced that allows for creating capacity within Microsoft Azure. Power BI Embedded 著重於應用程式和客戶。Power BI Embedded is focused on your application and your customers.

本文將探討如何內嵌組織和客戶的 Power BI 內容。This article will look at embedding your Power BI content for both your organization and your customers. 這兩個案例的步驟類似。The steps are similar between the two scenarios. 對客戶進行內嵌的特定步驟時,將會進行圖說文字。Callouts will be made when a step is specific to embedding for your customer.

您需要使用應用程式執行幾個步驟,來達成這項作業。There are a few steps you have to do with your application to make this possible. 我們將探討可讓您在應用程式內建立和使用已內嵌內容所需的步驟。We will go through the steps needed to allow you to create and use embedded content within your application.

注意

Power BI API 仍然將應用程式工作區稱為群組。The Power BI APIs still refer to app workspaces as groups. 任何對群組的引述都表示您處理的是應用程式工作區。Any references to groups mean that you are working with app workspaces.

步驟 1︰設定內嵌的分析開發環境Step 1: Setup your embedded analytics development environment

在您開始將儀表板和報表內嵌到應用程式之前,需要確定環境設定成允許進行內嵌。Before you start embedding dashboards and reports into your application, you need to make sure your environment is setup to allow for embedding. 在安裝時,您必須執行下列作業。As part of the setup, you will need to do the following.

注意

開發應用程式時,不需要 Power BI 容量。Power BI capacity is not required for development of your application. 應用程式開發人員必須擁有 Power BI Pro 授權。The developers of the application will need to have a Power BI Pro license.

Azure Active Directory 租用戶Azure Active Directory tenant

您需要有 Azure Active Directory (Azure AD) 租用戶,才能內嵌 Power BI 中的項目。You will need an Azure Active Directory (Azure AD) tenant in order to embed items from Power BI. 此租用戶必須至少要有一個 Power BI Pro 使用者。This tenant must have at least one Power BI Pro user. 您也必須在租用戶內定義 Azure AD 應用程式。You will also need to define an Azure AD app within the tenant. 您可以利用現有 Azure AD 租用戶,或特別針對內嵌用途建立新的 Azure AD 租用戶。You can make use of an existing Azure AD tenant or create a new one specifically for embedding purposes.

如果您是對客戶進行內嵌,您必須判斷要使用的租用戶設定。You will need to determine what tenant setup to use if you are embedding for your customers.

  • 使用現有的公司 Power BI 租用戶嗎?Use your existing corporate Power BI tenant?
  • 您的應用程式使用不同的租用戶嗎?Use a separate tenant for your application?
  • 每個客戶都使用個別租用戶嗎?Use a separate tenant for each customer?

如果您不想使用現有的租用戶,而決定為應用程式或每個客戶建立新租用戶,請參閱建立 Azure Active Directory 租用戶如何取得 Azure Active Directory 租用戶If you do not want to use an existing tenant, you can decide to create a new tenant for your application, or one for each customer, see Create an Azure Active Directory tenant or How to get an Azure Active Directory tenant.

建立 Power BI Pro 使用者帳戶Create a Power BI Pro user account

您只需要單一 Power BI Pro 帳戶,就能內嵌內容。You only need a single Power BI Pro account to embed content. 不過,您可能想要有幾個不同的使用者具有項目的特定存取權。However, you may want to have a few different users that have specific access to items. 以下探討租用戶內可能要考慮的使用者。Here is a look at possible users to consider within your tenant.

下列帳戶必須存在於您的租用戶內,並且獲指派 Power BI Pro 授權。The following accounts will need to exist within your tenant and have a Power BI Pro license assigned to them. 需要 Power BI Pro 授權,才能使用 Power BI 中的應用程式工作區。A Power BI Pro license is required to work with app workspaces within Power BI.

組織/租用戶系統管理員使用者An organization/tenant admin user

如果對客戶進行內嵌,建議不要使用您的組織/租用戶全域管理員使用者作為應用程式所使用的帳戶。It is recommended that your organization/tenant Global Admin user should not be used as account your application uses if embedding for your customers. 這會將應用程式帳戶在租用戶內的存取權最小化。This is to minimize access that the application account has within your tenant. 建議管理員使用者是基於內嵌而建立之所有應用程式工作區的管理員。It is recommended that the admin user be an admin of all app workspaces created for the purpose of embedding.

將建立內容之分析師的帳戶Accounts for analysts that will create content

您可能有多位使用者建立 Power BI 的內容。You may have multiple users that create content for Power BI. 針對每位建立內容並將其部署至 Power BI 的分析師,您都需要有其 Power BI Pro 帳戶。You will need a Power BI Pro account for each analyst that is creating and deploying content to Power BI.

用於對客戶進行內嵌的應用程式「主」使用者帳戶An application master user account for embedding for your customers

主帳戶是應用程式將在內嵌客戶內容時使用的帳戶。The master account is the account your application will use when embedding content for your customers. 此案例通常適用於 ISV 應用程式。The scenario is typically for ISV applications. 主帳戶其實是您組織內唯一需要的帳戶。The master account is really the only required account you need within your organization. 它也可以用作系統管理員和分析師帳戶,但不建議這麼做。It can also be used as the admin and analyst account, but it is not recommended. 應用程式後端將會儲存此帳戶的認證,並使用它取得 Azure AD 授權權杖以與 Power BI API 搭配使用。Your application's backend will store the credentials for this account and use it for acquiring an Azure AD auth token for use with the Power BI APIs. 這個帳戶將用來產生應用程式用於客戶的內嵌權杖。This account will be used to generate an embed token for the application to use for your customers.

主帳戶只是具有用於應用程式之 Power BI Pro 授權的一般使用者。The master account is just a regular user with a Power BI Pro license that you use with your application. 該帳戶必須是正用於內嵌之應用程式工作區的管理員。The account must be an admin of the app workspace that is being used for embedding.

應用程式註冊和權限App registration and permissions

您必須在 Azure AD 中註冊應用程式,才能進行 REST API 呼叫。You will need to register your application with Azure AD in order to make REST API calls. 如需詳細資訊,請參閱註冊 Azure AD 應用程式以內嵌 Power BI 內容For more information, see Register an Azure AD app to embed Power BI content.

建立應用程式工作區Create app workspaces

如果您要內嵌客戶的儀表板和報表,則必須將這些儀表板和報表放在應用程式工作區內。If you are embedding dashboards and reports for your customers, those dashboards and reports have to be placed within an app workspace. 上面所提及的「主」帳戶必須是應用程式工作區的管理員。The master account, that was mentioned above, must be an admin of the app workspace.

  1. 開始建立工作區。Start by creating the workspace. 選取 [工作區] > [建立應用程式工作區]。Select Workspaces > Create app workspace.

    建立應用程式工作區

    這會是放置您與同事共同作業之內容的位置。This will be the place to put content that you and your colleagues collaborate on.

  2. 提供工作區的名稱。Give the workspace a name. 如果對應的 [工作區識別碼] 無法使用,請編輯它,使其具有唯一識別碼。If the corresponding Workspace ID isn't available, edit it to come up with a unique ID.

    這也會成為應用程式的名稱。This will be the name of the app, too.

    為工作區命名

  3. 您可以設定幾個選項。You have a few options to set. 如果您選擇 [公用],則組織中的所有人都可以看到工作區中的內容。If you choose Public, anyone in your organization can see what’s in the workspace. 相反地,[私用] 則表示只有工作區的成員才能看到其內容。Private, on the other hand, means only members of the workspace can see its contents.

    設定私用或公用

    建立群組之後,您無法變更公用/私人設定。You can't change the Public/Private setting after you've created the group.

  4. 您也可以選擇成員是否可以編輯還是具有僅限檢視存取權。You can also choose if members can edit or have view-only access.

    設定編輯或僅限檢視

    僅將人員新增到應用程式工作區,讓他們可以編輯內容。Only add people to the app workspace so they can edit the content. 如果人員只會檢視內容,則請不要將他們新增至工作區。If they're only going to view the content, don't add them to the workspace. 您可以在發佈應用程式時再納入這些人員。You can include them when you publish the app.

  5. 新增想要讓他們存取工作區之人員的電子郵件地址,然後選取 [新增]。Add email addresses of people you want to have access to the workspace, and select Add. 您無法新增群組別名,只能新增個人。You can’t add group aliases, just individuals.

  6. 決定每一個人是成員還是系統管理員。Decide whether each person is a member or an admin.

    設定成員或系統管理員

    系統管理員可以編輯工作區本身,包括新增其他成員。Admins can edit the workspace itself, including adding other members. 除非成員具有僅限檢視存取權,否則成員可以編輯工作區中的內容。Members can edit the content in the workspace, unless they have view-only access. 管理員和成員都可以發佈應用程式。Both admins and members can publish the app.

  7. 選取 [儲存]。Select Save.

Power BI 會建立並開啟工作區。Power BI creates the workspace and opens it. 它會出現在您所屬的工作區清單中。It appears in the list of workspaces you’re a member of. 因為您是系統管理員,所以您可以選擇省略符號 (…) 返回,並透過新增成員或變更其權限來進行變更。Because you’re an admin, you can select the ellipsis (…) to go back and make changes to it, adding new members or changing their permissions.

編輯工作區

建立和上傳報表Create and upload your reports

您可以使用 Power BI Desktop 建立報表和資料集,接著將這些報表發佈到應用程式工作區。You can create your reports and datasets using Power BI Desktop and then publish those reports to an app workspace. 發佈報表的一般使用者必須有 Power BI Pro 授權,才能發佈至應用程式工作區。The end user publishing the reports need to have a Power BI Pro license in order to publish to an app workspace.

步驟 2︰內嵌內容Step 2: Embed your content

在應用程式內,您必須向 Power BI 進行驗證。Within your application, you will need to authenticate with Power BI. 如果您要內嵌客戶的內容,您會將「主」 帳戶的認證儲存在應用程式內。If you are embedding content for your customers, you will store the credentials for the master account within your application. 如需詳細資訊,請參閱 Authenticate users and get an Azure AD access token for your Power BI app (驗證使用者,並為 Power BI 應用程式取得 Azure AD 存取權杖)。For more information, see Authenticate users and get an Azure AD access token for your Power BI app.

驗證後,請在應用程式中使用 Power BI REST API 及 JavaScript API,將儀表板及報表內嵌至應用程式。Once authenticated, within your application, use the Power BI REST APIs and JavaScript APIs to embed dashboards and reports into your application.

若要對組織進行內嵌,請參閱下列逐步解說:For embedding for your organization, see the following walkthroughs:

若要對客戶進行內嵌 (適用於 ISV),請參閱下列文章:For embeding with your customers, which is typical for ISVs, see the following:

對客戶進行內嵌時,需要有內嵌權杖。When embedding for your customers, an embed token is required. 若要深入了解,請參閱 GenerateTokenTo learn more see, GenerateToken.

步驟 3:將解決方案升階至生產環境Step 3: Promote your solution to production

進入生產環境需要一些額外的步驟。Moving to production requires a few extra steps.

對組織進行內嵌Embedding for your organization

如果您要對組織進行內嵌,則只需要讓人員知道如何到達您的應用程式。If you are embedding for your organization, you only need to let people know how to get to your application.

若應用程式工作區 (群組) 提供容量,免費使用者就可以取用從該工作區內嵌的內容。Free users can consume content that is embedded from an app workspace (group), if that workspace is backed by capacity. 請將免費使用者列為應用程式工作區 (群組) 成員,以免收到 401 未授權錯誤。List the Free user as a member of app workspace (group), otherwise you receive a 401 unauthorized error. 下表列出 Office 365 中可用的 Power BI Premium SKU。The following table lists the available Power BI Premium SKUs available within Office 365.

節點容量Capacity Node 核心總數Total cores
(後端 + 前端)(Backend + frontend)
後端核心Backend Cores 前端核心Frontend Cores DirectQuery/即時連線限制DirectQuery/live connection limits 尖峰時間的頁面呈現上限Max page renders at peak hour
EM3EM3 4 個 v 核心4 v-cores 2 個核心,10GB RAM2 cores, 10GB RAM 2 個核心2 cores 601-1,200601-1,200
P1P1 8 個 v 核心8 v-cores 4 個核心,25GB RAM4 cores, 25GB RAM 4 個核心4 cores 每秒 30 個30 per second 1,201-2,4001,201-2,400
P2P2 16 個 v 核心16 v-cores 8 個核心,50GB RAM8 cores, 50GB RAM 8 個核心8 cores 每秒 60 個60 per second 2,401-4,8002,401-4,800
P3P3 32 個 v 核心32 v-cores 16 個核心,100GB RAM16 cores, 100GB RAM 16 個核心16 cores 每秒 120 個120 per second 4,801-96004,801-9600

注意

您必須是租用戶內的全域或帳務管理員,才能購買 Power BI Premium。You must be a Global or Billing Admin, within your tenant, in order to purchase Power BI Premium. 如需如何購買 Power BI Premium 的資訊,請參閱如何購買 Power BI PremiumFor information on how to purchase Power BI Premium, see How to purchase Power BI Premium.

對客戶進行內嵌Embedding for your customers

如果要為客戶進行內嵌作業,請執行下列作業。If you are embedding for your customers, do the following.

  • 如果您要使用不同的租用戶進行開發,則必須確定生產環境中具有應用程式工作區、儀表板和報表。If you are using a separate tenant for development, then you must make sure your app workspaces, along with dashboards and reports, are available in your production environment. 請務必在 Azure AD 中建立生產租用戶的應用程式,並指派適當的應用程式權限,如步驟 1 所示。Make sure that you create the application in Azure AD for your production tenant and assign the proper app permissions as indicated in Step 1.
  • 購買符合您需求的容量。Purchase a capacity that fits your needs. 您可以使用下表來了解您可能需要的 Power BI Embedded 容量 SKU。You can use the table below to understand which Power BI Embedded capacity SKU you may need. 如需詳細資料,請參閱內嵌的分析容量規劃白皮書For more details, see Embedded analytics capacity planning whitepaper. 當您準備好購買時,可以在 Microsoft Azure 入口網站內進行。When you are ready to purchase, you can do so within the Microsoft Azure portal. 如需如何建立 Power BI Embedded 容量的詳細資料,請參閱 Create Power BI Embedded capacity in the Azure portal (在 Azure 入口網站中建立 Power BI Embedded 容量)。For details on how to create Power BI Embedded capacity, see Create Power BI Embedded capacity in the Azure portal.

重要

因為內嵌權杖只適用於開發測試,所以 Power BI 主要帳戶可以產生的內嵌權杖數目有限。Because embed tokens are intended for development testing only, the number of embed tokens a Power BI master account can generate is limited. 必須購買容量才可進行生產環境內嵌案例。A capacity must be purchased for production embedding scenarios. 購買容量後,內嵌權杖產生的數量就不受限制。There is no limit to embed token generation when a capacity is purchased.

節點容量Capacity Node 核心總數Total cores
(後端 + 前端)(Backend + frontend)
後端核心Backend Cores 前端核心Frontend Cores DirectQuery/即時連線限制DirectQuery/live connection limits 尖峰時間的頁面呈現上限Max page renders at peak hour
A1A1 1 個 v 核心1 v-cores .5 個核心,3GB RAM.5 cores, 3GB RAM .5 個核心.5 cores 每秒 5 個5 per second 1-3001-300
A2A2 2 個 v 核心2 v-cores 1 個核心,5GB RAM1 core, 5GB RAM 1 個核心1 core 每秒 10 個10 per second 301-600301-600
A3A3 4 個 v 核心4 v-cores 2 個核心,10GB RAM2 cores, 10GB RAM 2 個核心2 cores 每秒 15 個15 per second 601-1,200601-1,200
A4A4 8 個 v 核心8 v-cores 4 個核心,25GB RAM4 cores, 25GB RAM 4 個核心4 cores 每秒 30 個30 per second 1,201-2,4001,201-2,400
A5A5 16 個 v 核心16 v-cores 8 個核心,50GB RAM8 cores, 50GB RAM 8 個核心8 cores 每秒 60 個60 per second 2,401-4,8002,401-4,800
A6A6 32 個 v 核心32 v-cores 16 個核心,100GB RAM16 cores, 100GB RAM 16 個核心16 cores 每秒 120 個120 per second 4,801-96004,801-9600
  • 在 [進階] 下,編輯應用程式工作區,並將它指派給容量。Edit the app workspace and assign it to a capacity under advanced.

    將應用程式工作區指派給容量

  • 將更新過的應用程式部署至生產環境,然後開始內嵌 Power BI 儀表板和報表。Deploy your updated application to production and begin embedding Power BI dashboards and reports.

管理員設定Admin settings

全域管理員 (或 Power BI 服務管理員) 可以為租用戶開啟或關閉使用 REST API 的功能。Global Admins, or Power BI service administrators, can turn the ability to use the REST APIs, on or off for a tenant. Power BI 管理員可以為整個組織或個別安全性群組進行此設定。Power BI admins can set this setting for the entire organization, or for individual security groups. 依據預設,會為整個組織啟用這個設定。It is enabled for the entire organization by default. 這會透過 Power BI 管理入口網站完成。This is done through the Power BI admin portal.

後續步驟Next steps

內嵌在 Power BI 之中Embedding with Power BI
如何將 Power BI Embedded 工作區集合內容移轉至 Power BIHow to migrate Power BI Embedded workspace collection content to Power BI
何謂 Power BI PremiumPower BI Premium - what is it?
如何購買 Power BI PremiumHow to purchase Power BI Premium
JavaScript API Git 存放庫JavaScript API Git repo
Power BI C# Git 存放庫Power BI C# Git repo
JavaScript 內嵌示範JavaScript embed sample
內嵌的分析容量規劃白皮書Embedded analytics capacity planning whitepaper
Power BI Premium 技術白皮書Power BI Premium whitepaper

有其他問題嗎?More questions? 嘗試在 Power BI 社群提問Try asking the Power BI Community