Power BI Embedded 迁移工具Power BI Embedded migration tool

此迁移工具可用于将报表从 Power BI Embedded Azure 服务 (PaaS) 复制到 Power BI 服务 (SaaS)。This migration tool can be used to copy your reports from the Power BI Embedded Azure service (PaaS) to the Power BI service (SaaS).

将内容从工作区集合迁移到 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 服务的 Power BI REST API 重新创建。Pushed datasets cannot be downloaded and will need to be recreated using the Power BI REST APIs for the Power BI service.
  • 2016 年 11 月 26 日前导入的 PBIX 文件将无法下载。PBIX files imported before November 26, 2016 will not be downloadable.


可以从 GitHub 下载迁移工具示例。You can download the migration tool sample from GitHub. 可以下载存储库的压缩文件,也可以将其复制到本地。You can either download a zip of the repository, or you can clone it locally. 下载完成后,可以在 Visual Studio 中打开 powerbi-migration-sample.sln,以生成和运行迁移工具。Once downloaded, you can open powerbi-migration-sample.sln within Visual Studio to build and run the migration tool.

迁移计划Migration Plans

迁移计划涉及对 Power BI Embedded 中的内容编辑目录的元数据,以及希望以何种方式将其发布到 Power BI 服务。Your migration plan is just metadata that catalogs the content within Power BI Embedded and how you want to publish them to the Power BI service.

开始新的迁移计划Start with a new migration plan

迁移计划涉及 Power BI Embedded 中可用项的元数据,随后会将该元数据移动到 Power BI 服务。A migration plan is the metadata of the items available in Power BI Embedded that you then want to move over to the Power BI service. 迁移计划存储为 XML 文件。The migration plan is stored as an XML file.

首先需要新建一个迁移计划。You will want to start by creating a new migration plan. 请执行以下操作新建迁移计划。To create a new migration plan, do the following.

  1. 选择“文件” > “新建迁移计划”。Select File > New Migration Plan.

  2. 在“选择 Power BI Embedded 资源组”对话框中,建议选择“环境”下拉列表,然后选择“生产”。In the Select Power BI Embedded Resource Group dialog, you will want to select the Environment dropdown and select prod.
  3. 系统将提示你进行登录。You will be prompted to sign in. 请使用 Azure 订阅登录名。You will use your Azure subscription login.


    不是用于登录 Power BI 的 Office 365 组织帐户。This is not your Office 365 organization account that you sign into Power BI with.

  4. 选择存储着 Power BI Embedded 工作区集合的 Azure 订阅。Select the Azure subscription which stores your Power BI Embedded workspace collections.

  5. 在订阅列表下,选择包含工作区集合的“资源组”,然后选择“选择”。Below the subscription list, select the Resource Group that contains your workspace collections and select Select.

  6. 选择“分析”。Select Analyze. 此操作可以得出 Azure 订阅中的项的清单,方便开始执行计划。This will get an inventory of the items within your Azure subscription for you to begin your plan.


    分析过程可能需要几分钟时间,具体取决于工作区集合的数量和工作区集合中存在内容的多少。The analyze process could take several minutes depending on the number of Workspace collections and how much content exists in the workspace collection.

  7. “分析”完成后,系统会提示保存迁移计划。When Analyze is complete, it will prompt you to save your migration plan.

至此,已经将迁移计划连接到 Azure 订阅。At this point, you have connected your migration plan to your Azure subscription. 阅读以下内容,了解执行迁移计划的流程。Read below to understand the flow of how to work with your migration plan. 流程包括分析与计划迁移、下载、创建组和上传。This includes Analyze & Plan Migration, Download, Create Groups and Upload.

保存迁移计划Save your migration plan

可以保存迁移计划供以后使用。You can save your migration plan for use later. 为此需要创建一个 XML 文件,在文件中包含迁移计划的所有信息。This will create an XML file that contained all the information in your migration plan.

执行以下操作保存迁移计划。To save your migration plan, do the following.

  1. 选择“文件” > “保存迁移计划”。Select File > Save Migration Plan.

  2. 命名文件或使用生成的文件名,然后选择“保存”。Give your file a name or use the generated file name and select Save.

打开现有的迁移计划Open an existing migration plan

可以打开保存的迁移计划以继续执行迁移。You can open a saved migration plan to continue working on your migration.

执行以下操作打开已保存的迁移计划。To open your existing migration plan, do the following.

  1. 选择“文件” > “打开现有的迁移计划”。Select File > Open Existing Migration Plan.

  2. 选择迁移文件,然后选择“打开”。Select your migration file and select Open.

第 1 步:分析与计划迁移Step 1: Analyze & Plan Migration

可以在“分析与计划迁移”选项卡上查看 Azure 订阅的资源组中的现有内容。The Analyze & Plan Migration tab gives you a view of what is currently in your Azure subscription’s resource group.


此处以 SampleResourceGroup 为例。We will look at the SampleResourceGroup as an example.

PaaS 拓扑PaaS Topology

PaaS 拓扑是“资源组”>“工作区集合”>“工作区”的列表。This is a listing of your Resource Group > Workspace collections > Workspaces. 资源组和工作区集合将显示友好名称。The resource group and workspace collections will show a friendly name. 工作区将显示 GUID。The workspaces will show a GUID.

列表中的项还会以 (#/#) 格式显示带颜色的数值。The items in the list will also display a color and a number in the format of (#/#). 数值表示可以下载的报表数。This indicates the number of reports that can be downloaded. 黑色表示所有报表都可以下载。A black color means that all reports can be downloaded.

红色表示有报表都不可下载。A red color means that some reports cannot be downloaded. 左边的数值表示可以下载的报表总数。The left number will indicate the total number of reports that can be downloaded. 右边的数值表示组内报表的总数。The number on the right indicates the total number of reports within the grouping.

可以选择 PaaS 拓扑内的某一项,然后在报表部分查看报表。You can select an item within the PaaS topology to display the reports in the reports section.


报表部分将列出可用的报表,并指示该报表是否可下载。The reports section will list out the reports available and indicates whether it can be downloaded or not.

目标结构Target structure

“目标结构”可指示工具将内容下载到哪里,以及如何上传内容。The Target structure is where you tell the tool where things will be downloaded to and how to upload them.

下载计划Download Plan

系统会自动创建路径。A path will automatically be created for you. 可以根据需要更改路径。You can change this path if you wish. 如果确实更改路径,需要选择“更新路径”。If you do change the path, you will need to select Update paths.


此操作不会实际执行下载。This does not actually perform the download. 它只指定报表将要下载到的位置。This is only specifying the structure of where the reports will be downloaded to.

上传计划Upload Plan

可以在这里指定 Power BI 服务中创建的应用工作区的前缀。Here you can specify a prefix to be used for the App Workspaces that will be created within the Power BI service. 之后,该前缀将作为 Azure 中的工作区的 GUID。After the prefix will be the GUID for the workspace that existed in Azure.


此操作不会实际在 Power BI 服务中创建组。This does not actually create the groups within the Power BI service. 它只会定义组的命名结构。This only defines the naming structure for the groups.

如果更改了前缀,则需要选择“生成上传计划”。If you change the prefix, you will need to select Generate Upload Plan.

可以根据需要右键单击某个组,然后在上传计划中直接选择重命名该组。You can right click on a group and choose to rename the group within the Upload plan directly, if desired.


组名称不能包含空格或无效字符。The name of the group must not contain spaces or invalid characters.

第 2 步:下载Step 2: Download

在“下载”选项卡上可以看到报表和关联元数据的列表。On the Download tab, you will see the list of reports and associated metadata. 可以查看现在的导出状态和以前的导出状态。You can see what the export status is along with the previous export status.

有两个选项。You have two options.

  • 选择特定报表,然后选择“下载选定报表”。Select specific reports and select Download Selected
  • 选择“全部下载”。Select Download All.

下载成功后会显示“完成”状态,该状态表示存在 PBIX 文件。For a successful download, you will see a status of Done and it will reflect that the PBIX file exists.

下载完成后,选择“创建组”选项卡。After the download is completed, select the Create Groups tab.

第 3 步:创建组Step 3: Create Groups

下载可用报表后,可以转到“创建组”选项卡。此选项卡将根据之前创建的迁移计划在 Power BI 服务内创建应用工作区。After you have downloaded the reports that are available, you can go to the Create Groups tab. This tab will create the app workspaces within the Power BI service based on the migration plan that you created. 它会使用“分析与计划迁移”中“上传”选项卡上提供的名称创建应用工作区。It will create the app workspace with the name you provided on the Upload tab within Analyze & Plan Migration.

若要创建应用工作区,可以选择“创建所选组”或“创建所有缺少的组”。To create the app workspaces, you can select either Create Selected Groups or Create All Missing Groups.

选择任何一个选项后,系统都将提示你进行登录。When you select either of these options, you will be prompted to sign in. 为在 Power BI 服务上创建应用工作区,建议使用 Power BI 服务的凭据。You will want to use your credentials for the Power BI service that you want to create the app workspaces on.

此操作会在 Power BI 服务中创建应用工作区。This will create the app workspace within the Power BI service. 但不会将报表上传到应用工作区。This does not upload the reports to the app workspace.

可以登录 Power BI 并验证是否存在工作区,以此来验证是否已创建应用工作区。You can verify that the app workspace was created by signing into Power BI and validating that the workspace exists. 这时可以看到工作区中不存在任何内容。You will notice that nothing is in the workspace.

创建工作区后,可以移到“上传”选项卡。After the workspace is created, you can move onto the Upload tab.

第 4 步:上传Step 4: Upload

在“上传”选项卡上进行操作可以将报表上传到 Power BI 服务。On the Upload tab, this will upload the reports to the Power BI service. 在此可以看到之前在“下载”选项卡上下载的一系列报表,以及基于迁移计划的目标组名称。You will see a list of the reports that we downloaded on the Download tab along with the target group name based on your migration plan.

可以上传选定报表,也可以上传所有报表。You can upload selected reports, or you could upload all the reports. 也可以将上传状态重置为重新上传项。You can also reset the upload status to re-upload items.

如果存在具有相同名称的报表,可以选择要执行的操作。You also have the option of selecting what to do if a report with the same name exists. 可以选择“中止”、“忽略”和“覆盖”。You can choose between Abort, Ignore and Overwrite.

重复的报表名称Duplicate report names

如果某个报表与之前的报表名称相同,但你知道其内容不同,则需要更改此报表的“TargetName”。If you have a report that has the same name, but you know it is a different report, you will need to change the TargetName of the report. 可以通过手动编辑迁移计划 XML 来更改名称。You can change the name by manually editing the migration plan XML.

需要关闭迁移工具进行更改,然后重新打开工具和迁移计划。You will need to close the migration tool to make the change and then re-open the tool and the migration plan.

在上面的示例中,有一个复制报表失败,其原因是存在具有相同名称的报表。In the above example, one of the cloned reports failed indicating a report with the same name existed. 如果查看迁移计划 XML,可以看到以下内容。If we go look at the migration plan XML, we will see the following.

    <PaaSReportLastImportTime>1/3/2017 2:10:19 PM</PaaSReportLastImportTime>
    <SaaSImportError>Report with the same name already exists</SaaSImportError>

建议更改失败项的 SaaSTargetReportName 名称。For the failed item, we can change the name of the SaaSTargetReportName.


然后在迁移工具中重新打开该计划,并上传之前失败的报表。We can then re-open the plan, in the migration tool, and upload the failed report.

回到 Power BI,可以看到报表和数据集已上传到应用工作区中。Going back to Power BI, we can see that the reports and datasets have been uploaded in the app workspace.

上传本地 PBIX 文件Upload a local PBIX file

可以上传本地版本的 Power BI Desktop 文件。You can upload a local version of a Power BI Desktop file. 需要关闭工具、编辑 XML 并在“PbixPath”属性中输入本地 PBIX 的完整路径。You will have to close the tool, edit the XML and put the full path to your local PBIX in the PbixPath property.

<PbixPath>[Full Path to PBIX file]</PbixPath>

编辑 xml 后,在迁移工具中重新打开计划并上传报表。After you have edited the xml, re-open the plan within the migration tool and upload the report.

DirectQuery 报表DirectQuery reports

需要进行更新,以便更新 DirectQuery 报表的连接字符串。You will need to update to update the connection string for DirectQuery reports. 在 powerbi.com 中完成此操作,也可以通过编程方式从 Power BI Embedded (Paas) 查询连接字符串。This can be done within powerbi.com, or you can programmatically query the connection string from Power BI Embedded (Paas). 有关示例,请参阅从 PaaS 报表提取 DirectQuery 连接字符串For an example, see Extract DirectQuery connection string from PaaS report.

然后可以在 Power BI 服务 (Saas) 中更新数据集的连接字符串,并设置数据源的凭据。You can then update the connection string for the dataset within the Power BI service (Saas) and set the credentials for the data source. 请参阅以下示例,了解如何执行此操作。You can look at the following examples to see how to do this.


将报表从 Power BI Embedded Azure 服务迁移到 Power BI 服务之后,现在可以更新应用程序,并将报表嵌入此应用工作区中。Now that your reports have been migrated from the Power BI Embedded Azure service to the Power BI service, you can now update your application and begin embedding the reports in this app workspace.

有关详细信息,请参阅如何将 Power BI Embedded 工作区集合内容迁移到 Power BIFor more information, see How to migrate Power BI Embedded workspace collection content to Power BI.

后续步骤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 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
Power BI Premium 白皮书Power BI Premium whitepaper

更多问题?More questions? 尝试咨询 Power BI 社区Try asking the Power BI Community