如何将 Power BI Embedded 工作区集合内容迁移到 Power BIHow to migrate Power BI Embedded workspace collection content to Power BI

了解如何从 Power BI Embedded 迁移到 Power BI 服务,并利用这些进展在应用中进行嵌入。Learn how to migrate from Power BI Embedded to the Power BI service and leverage advances for embedding in apps.

Microsoft 最近发布了 Power BI Premium,这是一个基于容量的新许可模型,可提高用户访问、共享和分发内容方式的灵活性。Microsoft recently 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 Premium,Power BI Embedded 和 Power BI 服务开始进行融合以推动在应用中嵌入 Power BI 内容的进展。With the introduction of Power BI Premium, Power BI Embedded and the Power BI service are converging to advance how Power BI content is embedded in apps. 这意味着,在嵌入内容时,将拥有一个 API 外围、一组一致的功能以及对最新 Power BI 功能(如仪表板、网关和应用工作区)的访问权限。This means you will have one API surface, a consistent set of capabilities and access to the latest Power BI features – such as dashboards, gateways and app workspaces – when embedding your content. 展望未来,你将能够从使用 Power BI Desktop 开始,移动到通过 Power BI Premium 实现的部署,这将在 2017 年第二个季度末公开发布。Moving forward you’ll be able to start with Power BI Desktop and move to deployment with Power BI Premium, which will be generally available late in the second quarter of 2017.

当前 Power BI Embedded 服务将在聚合产品/服务公开发布后的一段有限时间内继续可用:企业协议客户可在其现有协议到期前使用该服务;通过直接渠道或 CSP 渠道获取 Power BI Embedded 的客户可在 Power BI Premium 公开发布一年内享受该服务。The current Power BI Embedded service will continue to be available for a limited time following general availability of the converged offering: customers under an Enterprise Agreement will have access to through the expiration of their existing agreements; customers that acquired Power BI Embedded through Direct or CSP channels will enjoy access for one year from General Availability of Power BI Premium. 本文将在以下方面提供指导:如何从 Azure 服务迁移到 Power BI 服务,以及应用程序中会进行哪些更改。This article will provide some guidance for migrating from the Azure service to the Power BI service and what to expect for changes in your application.


虽然 Power BI 服务上的迁移具有依赖项,但在使用嵌入令牌时,Power BI 上没有为应用程序的用户提供依赖项。While the migration will take 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 to service non-Power BI users.

迁移准备Prepare for the migration

需要完成一些准备工作才能从 Power BI Embedded Azure 服务迁移到 Power BI 服务。There are a few things you need to do to prepare for migrating from Power BI Embedded Azure service over to the Power BI service. 你将需要一个可用的租户,以及具有 Power BI Pro 许可证的用户。You will 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.

    你将需要确定要使用的租户设置。You will need to determine what tenant setup to use.

  2. 在此新租户中创建一个用户,作为应用程序“主”帐户。Create a user within this new tenant that will act 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 will need to exist within your tenant.


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

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

    建议此用户成为为实现嵌入而创建的所有应用工作区的成员。It is recommended that this user be a member of all App workspaces created for the purpose of embedding.

  2. 将创建内容的分析师帐户。Accounts for analysts that will create content.

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

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

    应用程序后端将存储此帐户的凭据,并将其用于获取与 Power BI REST API 一起使用的 Azure AD 身份验证令牌。The applications backend will store the credentials for this account and use it for acquiring an Azure AD token for use with the Power BI REST APIs. 此帐户将用于生成应用程序的嵌入令牌。This account will be used to generate the embed token for the application. 此帐户还必须是为实现嵌入而创建的应用工作区的管理员。This account also needs to be an admin of the App workspaces created for embedding.


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

应用注册和权限App registration and permissions

你将需要在 Azure AD 中注册应用程序,并授予某些权限。You will need to register an application within Azure AD and grant certain permissions.

注册应用程序Register an application

必须向 Azure AD 注册应用,才能执行 REST API 调用。You will need to register your application with Azure AD in order to make REST API calls. 除了转到 Power BI 应用注册页,这还包括转到 Azure 门户来应用其他配置。This includes going to the Azure portal to apply additional configuration 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.

应使用应用主帐户来注册应用。You should register the application using the application master account.

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

如果应用程序服务多个客户,则可以利用应用工作区以更好地进行隔离。You can take advantage of App workspaces to provide better isoliation if your application is servicing multiple customers. 将在客户之间隔离仪表板和报表。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.


不能使用个人工作区来利用嵌入到非 Power BI 用户功能。You cannot use a personal workspace to take advantage of embedding to non-Power BI users.

你将需要具有 Pro 许可证的用户才能在 Power BI 中创建应用工作区。You will 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 will be an admin of that workspace by default.


应用主帐户必须是工作区的管理员。The application master account needs to be an admin of the workspace.

内容迁移Content migration

将内容从工作区集合迁移到 Power BI 服务可与当前解决方案同步进行,并且不需要停机。Migrating your content from your workspace collections to the Power BI service can be done in parallel to your current solution and doesn’t require any downtime.

可使用“迁移工具”帮助将内容从 Power BI Embedded 复制到 Power BI 服务。A migration tool is available for you to use in order to assist with copying content from Power BI Embedded to the Power BI service. 尤其是有大量内容时。Especially if you have a lot of content. 有关详细信息,请参阅 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 which 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 somewhat different migration flow.

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

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


  1. 从 PaaS 工作区调用下载 PBIX API。Call Download PBIX API from PaaS workspace.
  2. 保存 PBIX。Save PBIX.
  3. 将导入 PBIX 调用到 SaaS 工作区。Call Import PBIX to SaaS workspace.

DirectQuery 数据集和报表DirectQuery dataset & report


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

旧数据集和报表Old dataset & reports

这些数据集/报表是在 2016 年 10 月之前创建的。These are datasets/reports created before October 2016. 下载 PBIX 不支持 2016 年 10 月之前上传的 PBIXDownload PBIX doesn't support PBIXs which were uploaded before October 2016


  1. 从开发环境中获取 PBIX(内部源代码管理)。Get PBIX from your development environment (your internal source control).
  2. 将导入 PBIX 调用到 SaaS 工作区。Call Import PBIX to SaaS workspace.

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

下载 PBIX 不支持推送 API 数据集。Download PBIX doesn't support Push API datasets. 无法将推送 API 数据集从 PaaS 移植到 SaaS。Push API dataset data can't be ported from PaaS to SaaS.


  1. 使用数据集 JSON 调用“创建数据集” API,在 SaaS 工作区中创建数据集。Call "Create dataset" API with dataset Json to create dataset in SaaS workspace.
  2. 为创建的数据集重新生成报表Rebuild report for the created dataset.

通过尝试以下方法,可使用一些解决方法将推送 API 报表从 PaaS 迁移到 SaaS。It is possible using some workarounds to migrate the push api report from PaaS to SaaS by trying the following.

  1. 将一些虚 PBIX 上传到 PaaS 工作区。Uploading some dummy PBIX to PaaS 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 上传到 SaaS 工作区。Upload dummy PBIX to your SaaS workspace.
  5. 在 SaaS 工作区中创建推送数据集。Create push dataset in your SaaS workspace.
  6. 将报表重新绑定到推送 API 数据集。Rebind report to push api dataset.

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

除了从 Power BI Embedded Azure 服务迁移的内容外,还可使用 Power BI Desktop 创建报表和数据集,然后将这些报表发布到应用工作区。In addition to the content you migrated from the Power BI Embedded Azure service, 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 中的报表位置。You will need to modify your application to use the Power BI REST APIs and the report location inside powerbi.com.
  2. 使用应用程序的帐户重新生成 AuthN/AuthZ 身份验证。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. 将报表从 powerbi.com 嵌入到应用程序。Embed your reports from powerbi.com into your application.

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

在应用程序中,将在应用程序中管理的用户映射到应用程序的 Power BI 凭据。Within your application, you will 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 will be 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 will need to do the following.

  • 如果要使用单独的租户进行开发,则需要确保应用工作区以及仪表板和报表在生产环境中可用。If you are using a separate tenant for development, then you will need to make sure your app workspaces, along with dashboards and reports, are available in your production environment. 还需要确保在 Azure AD 中为生产租户创建了应用程序,并按照步骤 1 中所述分配了适当的应用权限。You will also need to 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. 准备好购买时,可在 Office 365 管理中心内执行此操作。When you are ready to purchase, you can do so within the Office 365 admin center.

    [AZURE.INFORMATION] 有关如何购买 Power BI Premium 的信息,请参阅如何购买 Power BI Premium[AZURE.INFORMATION] For information on how to purchase Power BI Premium, see How to purchase Power BI Premium.

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

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

迁移后After migration

应在 Azure 中执行一些清理操作。You should do some cleanup within Azure.

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

后续步骤Next steps

使用 Power BI 嵌入Embedding with Power BI
Power BI Embedded 迁移工具Power BI Embedded migration tool
用于从 Power BI Embedded 迁移内容的代码片段Code snippets for migrating content from Power BI Embedded
如何嵌入 Power BI 仪表板、报表和磁贴How to embed your Power BI dashboards, reports and tiles
什么是 Power BI Premium?Power BI Premium - what is it?
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