使用 Power BI Embedded 迁移工具Use the Power BI Embedded migration tool

可以使用 Power BI Embedded 迁移工具将报表从 Power BI 工作区集合复制到 Power BI Embedded。The Power BI Embedded migration tool can be used to copy your reports from the Power BI Workspace Collections to Power BI Embedded.

将内容从工作区集合迁移到 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.

限制Limitations

  • 已推送的数据集不可下载,需要使用 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.

下载Download

可以从 GitHub 下载迁移工具示例。You can download the migration tool sample from GitHub. 可以下载存储库的 zip 文件,或者将其克隆到本地。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 工作区集合中的内容编目,并描述如何将这些内容发布到 Power BI Embedded。Your migration plan is just metadata that catalogs the content within Power BI Workspace Collections and how you want to publish them to Power BI Embedded.

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

迁移计划是 Power BI 工作区集合中提供的、以后需要移到 Power BI Embedded 的元数据。A migration plan is the metadata of the items available in Power BI Workspace Collections that you then want to move over to Power BI Embedded. 迁移计划以 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 工作区集合资源组”对话框中,选择“环境”下拉菜单,并选择“生产”。In the Select Power BI Workspace Collections 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 工作区集合资源的 Azure 订阅。Select the Azure subscription which stores your Power BI Workspace Collections resource.

    选择 Azure 订阅

  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 and 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

这是“资源组”>“工作区集合”>“工作区”的列表。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.

报告Reports

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

Power BI 工作区集合中的报表列表

目标结构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 服务的凭据。You will want to use your credentials for the Power BI service that you want to create the app workspaces on.

Power BI 登录屏幕

这会在 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.

Power BI 服务中的应用工作区

创建工作区后,可以转到“上传”选项卡。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

如果存在同名的报表,但已知它是一份不同的报表,则需要更改报表的 TargetNameIf 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.

<ReportMigrationData>
    <PaaSWorkspaceCollectionName>SampleWorkspaceCollection</PaaSWorkspaceCollectionName>
    <PaaSWorkspaceId>4c04147b-d8fc-478b-8dcb-bcf687149823</PaaSWorkspaceId>
    <PaaSReportId>525a8328-b8cc-4f0d-b2cb-c3a9b4ba2efe</PaaSReportId>
    <PaaSReportLastImportTime>1/3/2017 2:10:19 PM</PaaSReportLastImportTime>
    <PaaSReportName>cloned</PaaSReportName>
    <IsPushDataset>false</IsPushDataset>
    <IsBoundToOldDataset>false</IsBoundToOldDataset>
    <PbixPath>C:\MigrationData\SampleResourceGroup\SampleWorkspaceCollection\4c04147b-d8fc-478b-8dcb-bcf687149823\cloned-525a8328-b8cc-4f0d-b2cb-c3a9b4ba2efe.pbix</PbixPath>
    <ExportState>Done</ExportState>
    <LastExportStatus>OK</LastExportStatus>
    <SaaSTargetGroupName>SampleMigrate</SaaSTargetGroupName>
    <SaaSTargetGroupId>6da6f072-0135-4e6c-bc92-0886d8aeb79d</SaaSTargetGroupId>
    <SaaSTargetReportName>cloned</SaaSTargetReportName>
    <SaaSImportState>Failed</SaaSImportState>
    <SaaSImportError>Report with the same name already exists</SaaSImportError>
</ReportMigrationData>

针对失败的项,可以更改 SaaSTargetReportName 的名称。For the failed item, we can change the name of the SaaSTargetReportName.

<SaaSTargetReportName>cloned2</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.

Power BI 服务中的报表列表

上传本地 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 服务中数据集的连接字符串,并设置数据源的凭据。You can then update the connection string for the dataset within the Power BI service and set the credentials for the data source. 可以查看以下示例来了解如何执行此操作。You can look at the following examples to see how to do this.

后续步骤Next steps

将报表从 Power BI 工作区集合迁移到 Power BI Embedded 之后,接下来可以更新应用程序中,开始在此应用工作区中嵌入报表。Now that your reports have been migrated from Power BI Workspace Collections to Power BI Embedded, you can now update your application and begin embedding the reports in this app workspace.

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

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