如何将 Power BI 工作区集合内容迁移到 Power BI EmbeddedHow to migrate Power BI Workspace Collection content to Power BI Embedded

了解如何从 Power BI 工作区集合迁移到 Power BI Embedded。Learn how to migrate from Power BI Workspace Collections to Power BI Embedded. 本文提供有关从 Azure Power BI 工作区集合迁移到 Power BI Embedded 的指导。This article provides guidance for migrating from the Azure Power BI Workspace Collections to Power BI Embedded. 我们还会了解对应用程序更改的期望。We also look at what to expect for application changes.

在 Power BI Premium 版本公开上市之后,Power BI 工作区集合资源可继续使用有限时间。The Power BI Workspace Collections resource continues to be available for a limited time after general availability of the Power BI Premium release. 企业协议涵盖的客户可以在其现有协议过期之后访问其现有工作区集合。Customers under an Enterprise Agreement have access to their existing workspace collections through the expiration of their existing agreements. 通过直接或 CSP 渠道获取 Power BI 工作区集合的客户可在 Power BI Premium 公开上市之后享有一年时间的访问权限。Customers that acquired Power BI Workspace Collections through Direct or CSP channels enjoy access for one year from General Availability of Power BI Premium.

重要

虽然迁移依赖于 Power BI 服务,不过在使用嵌入令牌时,应用程序的用户不依赖于 Power BI。While the migration takes a dependency on the Power BI service, there is not a dependency on Power BI for the users of your application when using an embed token. 他们无需注册 Power BI 即可查看应用程序中的嵌入内容。They do not need to sign up for Power BI to view the embedded content in your application. 可以使用此嵌入方法为客户嵌入 Power BI。You can use this embedding approach embed Power BI for your customers.

Power BI Embedded 流

准备迁移Prepare for the migration

对于从 Power BI 工作区集合服务迁移转移到 Power BI Embedded,需要进行一些准备工作。There are a few things you need to do to prepare for migrating from Power BI Workspace Collections service over to Power BI Embedded. 需要有一个租户以及具有 Power BI Pro 许可证的用户可用。You need a tenant available, along with a user that has a Power BI Pro license.

  1. 确保可以访问 Azure Active Directory (Azure AD) 租户。Make sure you have access to an Azure Active Directory (Azure AD) tenant.

    要使用哪个租户?Which tenant to use?

  2. 在此新租户中创建充当应用程序“主”帐户的用户。Create a user within this new tenant that acts as your application "master" account. 该帐户需要注册 Power BI,并需要分配有 Power BI Pro 许可证。That account needs to sign up for Power BI and needs to have a Power BI Pro license assigned to it.

Azure AD 中的帐户Accounts within Azure AD

租户中需要存在以下帐户。The following accounts need to exist within your tenant.

备注

这些帐户需要具有 Power BI Pro 许可证才能使用应用工作区。These accounts need to have Power BI Pro licenses in order to use App workspaces.

  1. 租户管理员用户。A tenant admin user.

    建议嵌入应用工作区中将租户管理员列为成员。It is recommended that the embedding app workspace has the tenant admin listed as a member.

  2. 用于创建内容的分析员的帐户。Accounts for analysts that create content.

    这些用户应根据需要分配给应用工作区。These users should be assigned to app workspaces as needed.

  3. 应用程序主用户帐户或服务帐户。An application master user account, or service account.

    应用程序后端会存储此帐户的凭据。The applications backend stores the credentials for this account. 使用主帐户获取与 Power BI REST API 一起使用的 Azure AD 令牌。Use the master account for acquiring an Azure AD token for use with the Power BI REST APIs. 此帐户用于为应用程序生成嵌入令牌。This account is used to generate the embed token for the application. 主帐户需要是为进行嵌入而创建的应用工作区的管理员。The master account needs to be an admin of the app workspaces created for embedding.

    此帐户只是组织中用于嵌入用途的常规用户帐户。This account is just a regular user account in your organization that is used for the purposes of embedding.

应用注册和权限App registration and permissions

若要进行 REST API 调用,请向 Azure AD 注册应用程序。To make REST API calls, register an application with Azure AD. 添加配置在 Power BI 应用注册页以及 Azure 门户中应用。Addition configuration is applied within the Azure portal in addition to the Power BI app registration page. 有关详细信息,请参阅注册 Azure AD 应用以嵌入 Power BI 内容For more information, see Register an Azure AD app to embed Power BI content.

建议使用应用程序帐户来注册应用程序。The recommendation is to register the application using the application master account.

创建应用工作区(必需)Create app workspaces (Required)

如果应用程序为多个客户提供服务,则可以利用应用工作区提供更好的隔离。If your application is servicing multiple customers, you can take advantage of app workspaces to provide better isolation. 仪表板和报表会在客户之间进行隔离。Dashboards and reports would be isolated between your customers. 随后可以对每个应用工作区使用一个 Power BI 帐户以进一步在客户之间隔离应用程序体验,不过可以仅使用一个帐户以保持简单性。You could then use a Power BI account per app workspace to further isolate application experiences between your customers, but you can just use one account to keep it simple.

重要

无法使用个人工作区(“我的工作区”)来利用对客户的嵌入。You cannot use a personal workspace (a "My workspace") to take advantage of embedding to your customers.

需要具有 Pro 许可证的用户才能在 Power BI 中创建应用工作区。You need a user that has a Pro license in order to create an app workspace within Power BI. 创建应用工作区的 Power BI 用户在默认情况下是该工作区的管理员。The Power BI user that creates the App workspace is an admin of that workspace by default. 应用程序主帐户需要是工作区的管理员。The application master account needs to be an admin of the workspace.

内容迁移Content migration

将内容从工作区集合迁移到 Power BI Embedded 可以与当前解决方案并行进行,无需任何停机时间。Migrating your content from your workspace collections to Power BI Embedded can be done in parallel to your current solution and doesn’t require any downtime.

可使用“迁移工具”将内容从 Power BI 工作区集合复制到 Power BI Embedded。A migration tool is available for you to use in order to assist with copying content from Power BI Workspace Collections to Power BI Embedded. 尤其是你具有许多报表时。Especially if you have many reports. 有关详细信息,请参阅 Power BI Embedded 迁移工具For more information, see Power BI Embedded migration tool.

内容迁移主要依靠两个 API。Content migration relies mainly on two APIs.

  1. 下载 PBIX - 此 API 可以下载在 2016 年 10 月之后上传到 Power BI 的 PBIX 文件。Download PBIX - this API can download PBIX files that were uploaded to Power BI after October 2016.
  2. 导入 PBIX - 此 API 将任何 PBIX 上传到 Power BI。Import PBIX - this API uploads any PBIX to Power BI.

有关一些相关代码片段,请参阅用于从 Power BI Embedded 迁移内容的代码片段For some related code snippets, see Code snippets for migrating content from Power BI Embedded.

报表类型Report types

有几种类型的报表,每种需要不同的迁移流。There are several types of reports, each requiring a different migration flow.

缓存数据集和报表Cached dataset and report

缓存数据集指导入了数据的 PBIX 文件,而不是实时连接或 DirectQuery 连接。Cached datasets refer to PBIX files that had imported data as opposed to a live connection or DirectQuery connection.

Flow

  1. 从 Power BI 工作区集合工作区调用下载 PBIX API。Call Download PBIX API from your Power BI Workspace Collection workspace.
  2. 保存 PBIX。Save PBIX.
  3. 为 Power BI Embedded 工作区调用导入 PBIX。Call Import PBIX for your Power BI Embedded workspace.

DirectQuery 数据集和报表DirectQuery dataset and report

Flow

  1. 调用 GET https://api.powerbi.cn/v1.0/collections/{collection_id}/workspaces/{wid}/datasets/{dataset_id}/Default.GetBoundGatewayDataSources 并保存收到的连接字符串。Call GET https://api.powerbi.cn/v1.0/collections/{collection_id}/workspaces/{wid}/datasets/{dataset_id}/Default.GetBoundGatewayDataSources and save connection string received.
  2. 从 Power BI 工作区集合工作区调用下载 PBIX API。Call Download PBIX API from your Power BI Workspace Collection workspace.
  3. 保存 PBIX。Save PBIX.
  4. 为 Power BI Embedded 工作区调用导入 PBIX。Call Import PBIX for your Power BI Embedded workspace.
  5. 通过调用 POST https://api.powerbi.cn/v1.0/myorg/datasets/{dataset_id}/Default.SetAllConnections 更新连接字符串Update connection string by calling - POST https://api.powerbi.cn/v1.0/myorg/datasets/{dataset_id}/Default.SetAllConnections
  6. 通过调用 GET https://api.powerbi.cn/v1.0/myorg/datasets/{dataset_id}/Default.GetBoundGatewayDataSources 获取 GW ID 和数据源 IDGet GW ID and datasource ID by calling - GET https://api.powerbi.cn/v1.0/myorg/datasets/{dataset_id}/Default.GetBoundGatewayDataSources
  7. 通过调用 PATCH https://api.powerbi.cn/v1.0/myorg/gateways/{gateway_id}/datasources/{datasource_id} 更新用户的凭据Update user's credentials by calling - PATCH https://api.powerbi.cn/v1.0/myorg/gateways/{gateway_id}/datasources/{datasource_id}

旧数据集和报表Old dataset and reports

2016 年 10 月之前上传的报表不支持下载 PBIX 功能。Reports uploaded before October 2016 don't support the Download PBIX feature.

Flow

  1. 从开发环境(内部源代码管理)获取 PBIX。Get PBIX from your development environment (your internal source control).
  2. 为 Power BI Embedded 工作区调用导入 PBIX。Call Import PBIX for your Power BI Embedded workspace.

推送数据集和报表Push Dataset and report

下载 PBIX 不支持推送 API 数据集。Download PBIX doesn't support Push API datasets. 推送 API 数据集数据无法从 Power BI 工作区集合移植到 Power BI Embedded。Push API dataset data can't be ported from Power BI Workspace Collections to Power BI Embedded.

Flow

  1. 使用数据集 Json 调用“创建数据集”API 可为 Power BI Embedded 工作区创建数据集。Call "Create dataset" API with dataset Json to create dataset for your Power BI Embedded workspace.
  2. 为创建的数据集重新生成报表*。Rebuild report for the created dataset*.

可以通过尝试以下方式,使用一些解决方法将推送 API 报表从 Power BI 工作区集合迁移到 Power BI Embedded:It is possible using some workarounds to migrate the push api report from Power BI Workspace Collections to Power BI Embedded by trying the following:

  1. 将某个虚拟 PBIX 上传到 Power BI 工作区集合工作区。Uploading some dummy PBIX to your Power BI Workspace Collection workspace.
  2. 克隆推送 API 报告并将它绑定到步骤 1 中的虚拟 PBIX。Clone the push api report and bind it to the dummy PBIX from step 1.
  3. 通过虚拟 PBIX 下载推送 API 报表。Download push API report with the dummy PBIX.
  4. 将虚拟 PBIX 上传到 Power BI Embedded 工作区。Upload dummy PBIX to your Power BI Embedded workspace.
  5. 在 Power BI Embedded 工作区中创建推送数据集。Create push dataset in your Power BI Embedded workspace.
  6. 将报表重新绑定到推送 API 数据集。Rebind report to push api dataset.

创建并上传新报表Create and upload new reports

除了从 Power BI 工作区集合迁移的内容之外,可以使用 Power BI Desktop 创建报表和数据集,然后将这些报表发布到应用工作区。In addition to the content you migrated from Power BI Workspace Collections, 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.

重新生成应用程序Rebuild your application

  1. 修改应用程序以使用 Power BI REST API 和 powerbi.com 中的报表位置。Modify your application to use the Power BI REST APIs and the report location inside powerbi.com.

  2. 使用应用程序的主帐户重新生成身份验证/授权身份验证。Rebuild your AuthN/AuthZ authentication using the master account for your application. 可以使用嵌入令牌允许此用户代表其他用户。You can take advantage of using an embed token to allow this user to act on behalf of other users.

  3. 将报表从 Power BI Embedded 嵌入到应用程序中。Embed your reports from Power BI Embedded into your application. 有关详细信息,请参阅如何嵌入 Power BI 仪表板、报表和磁贴For more information, see How to embed your Power BI dashboards, reports and tiles.

将用户映射到 Power BI 用户Map your users to a Power BI user

在应用程序中,将在应用程序中管理的用户映射到主 Power BI 凭据以用于应用程序。Within your application, you map users that you manage within the application to a master Power BI credential for the purposes of your application. 此 Power BI 主帐户的凭据存储在应用程序中,用于创建嵌入令牌。The credentials for this Power BI master account are stored within your application and be used to creating embed tokens.

准备好进行生产时要执行的操作What to do when you are ready for production

准备好移动到生产环境时,需要执行以下操作:When you are ready to move to production, you need to do the following:

  • 如果使用单独租户进行开发,则需要确保应用工作区以及仪表板和报表在生产环境中可用。If you are using a separate tenant for development, then you need to make sure your app workspaces, along with dashboards and reports, are available in your production environment. 确保在 Azure AD 中为生产租户创建了应用程序,并分配了正确的应用权限,如步骤 1 所示。Make sure that you created the application in Azure AD for your production tenant and assigned the proper app permissions as indicated in Step 1.

  • 购买符合需求的容量。Purchase a capacity that fits your needs. 可以使用嵌入式分析容量规划白皮书来帮助了解可能需要什么。You can use the Embedded analytics capacity planning whitepaper to help understand what you may need. 准备好进行购买时,可以在 Azure 门户中购买 Power BI Embedded 资源。When you are ready to purchase, you can purchase a Power BI Embedded resource within the Azure portal.

  • 编辑应用工作区,并在“高级”下将它分配给容量。Edit the App workspace and assign it to a capacity under advanced.

    在 powerbi.com 中将应用工作区中分配给容量

  • 将更新的应用程序部署到生产环境,然后开始从 Power BI Embedded 嵌入报表。Deploy your updated application to production and begin embedding reports from Power BI Embedded.

迁移之后After migration

需要在 Power BI 工作区集合中进行一些清理。Some cleanup is needed within Power BI Workspace Collections.

  • 在 Power BI 工作区集合的 Azure 服务中删除部署的解决方案的所有工作区。Remove all workspaces off of the deployed solution within the Azure service of Power BI Workspace Collections.
  • 删除 Azure 中存在的任何工作区集合。Delete any Workspace Collections that exist within Azure.

后续步骤Next steps

祝贺。Congratulations. 应用程序现在迁移到 Power BI Embedded。Your application is now migrated to Power BI Embedded. 有关如何嵌入 Power BI 仪表板、报表和数据集的信息,请参阅如何嵌入 Power BI 仪表板、报表和磁贴For information about how to embed your Power BI dashboards, reports and datasets, see How to embed your Power BI dashboards, reports and tiles.

有更多问题?More questions? 尝试在 Power BI 社区中提问Try asking the Power BI Community