通过打包进行环境和租户应用迁移Environment and tenant app migration through Packaging

了解如何通过打包将资源从一个环境迁移到另一个环境。Learn how to migrate resources from one environment to another with packaging. 这些环境可以位于同一租户中,也可以跨不同的租户。These environments can be within the same tenant or across different tenants.

场景The scenario

可能需要迁移资源的一种常见场景是,你有一个测试或开发环境,同时又有一个生产环境。One common scenario where you may want to migrate resources is where you have Test or Dev environments and a Production environment. 开发人员和测试人员对其环境中的应用进行访问时,其权限很宽松。Developers and testers have wide access to the apps in their environments. 但将新应用迁移到生产环境中时,对更新和更改权限的控制会很严格。But when it comes time to migrate a new app to production, that environment has rigorous control over permissions to update and change it.

另一场景是,每个客户都有其自己的环境和数据,Another scenario is one where each customer has their own environment and data. 添加新客户时,将为其创建新环境,然后再将应用迁移到环境中。When a new customer is added, a new environment is created for them, and you would migrate apps into their environment.

可以通过打包迁移哪些资源?Which resources can I migrate through packaging?

导出应用时,应用的从属资源也会导出到包中。When you export an app, the dependent resources for your app will also get exported into the package. 最初仅支持所有可能的资源类型的子集,如下表所示。Initially only a subset of all possible resource types will be supported as outlined in the table below.

资源类型Resource type 受支持Supported 导入选项Import options
应用App Yes 有两个选项可用于将应用导入到环境:There are two options to import an app into an environment:
  1. 新建 – 在导入包的环境中将此应用创建为新应用。Create new – The app will be created as a new app in the environment where the package is imported.
  2. 更新 - 环境中已存在此应用,导入此包后将更新此应用。Update - the app already exists in the environment and will be updated when this package is imported.
Flow Yes 有两个选项可用于将流导入到环境:There are two options to import a flow into an environment:
  1. 新建 – 在导入包的环境中将此流创建为新流。Create new – The flow will be created as a new flow in the environment where the package is imported.
  2. 更新 - 环境中已存在此流,导入此包后将更新此流。Update - The flow already exists in the environment and will be updated when this package is imported.
注意:流依赖的所有资源也会包含在导出的应用包内,并需要使用导入的包进行配置。 NOTE: All resources that the flow depends on will also be included within the app package that is exported and will need to be configured with the package is imported
CDS 实体自定义项和选择列表CDS Entity Customizations and Picklists Yes 有两个选项可用于将 CDS 实体或选择列表导入环境:There are two options to import CDS Entities or Picklists in an environment:
  1. 覆盖 - 如果有使用相同名称的资源,导入后将替换此资源。Overwrite - If there's a resource with the same name, this import will replace it. 如果没有匹配的资源,将创建新资源。If there isn’t a matching resource, a new resource will be created.
  2. 合并 – 如果有使用相同名称的实体或选择列表,则会添加新字段或实体,但不会删除缺失的字段或条目。Merge – If there's an entity or picklist with the same name, new fields or entries will be added, but missing fields or entries won’t be removed.
自定义连接器Custom Connectors No 应用依赖自定义连接器时,当前不支持将连接器导出为包的一部分。If an app depends on a custom connector we do not currently support exporting the connector as a part of the package.

如果应用依赖自定义连接器,目前唯一的选择是在目标环境中手动重新创建或更新该连接器,并在导入包时选择该连接器。If you have an app that relies on a custom connector, your only current option is to manually re-create or update the connector in your target environment and select that connector when you import the package.

连接Connections No 应用依赖连接(例如带凭据的 SQL 连接)时,当前不支持将连接或凭据导出为包的一部分。If an app depends on a connection (such as a SQL connection w/ credentials), we do not currently support exporting the connection or credentials as a part of the package.

如果应用依赖共享连接(例如 SQL),目前唯一的选择是,使用相应的凭据在目标环境中手动重新创建该连接,并在导入包时选择该连接。If you have an app that relies on a shared connection (like SQL), your only current option is to manually re-create that connection with the appropriate credentials in your target environment and select that connection when you import the package.

CDS 自定义角色和权限集CDS Custom Roles and Permission Sets No 当前不支持导出自定义 CDS 角色和/或权限集,因此目前唯一的选择是在目标环境中手动重新创建这些实体。Exporting custom CDS roles and/or permission sets is not currently supported, so the only option today is to manually re-create these entities in your target environment.
网关Gateways No 网关仅在默认(和 {租户名称}(预览版提供))环境中受支持,因此不能导出/迁移。Gateways are only supported in the default (and {tenant name} (from preview) ) environments, so export/migration is not supported.
CDS 数据行CDS data rows No 当前不支持导出 CDS 实体中的行,因此目前唯一的选择是,在新环境中应用 CDS 架构更改后,手动导出和导入数据。Export rows from CDS entities is not current supported, so the only option today to manually export and import data after your CDS schema changes have been applied in a new environment.

如何获取打包应用的权限?How do I get access to packaging for my app?

拥有应用“编辑”权限的所有用户均可导出应用。The ability to export an app is available to any user with "Can edit" permission to the app.

拥有目标环境的“环境制作”权限的所有用户均可导入应用。The ability to import an app is available to any user with "Environment Maker" permission in the destination environment.

用户必须拥有 PowerApps 计划 2 或 PowerApps 计划 2 试用版许可证才能导出或导入任何应用。A user must have a PowerApps Plan 2 or PowerApps Plan 2 trial license in order to export or import any app.

注意:虽然打包功能目前处于预览状态,但是所有拥有 PowerApps 有效许可证的用户均可在他们的应用和环境上试用打包功能。NOTE: While packaging is in preview, any user with a valid PowerApps license will be able to try out packaging for their apps and environments.

导出应用Exporting an app

  1. http://web.powerapps.com 中,单击或点击“应用”,选择省略号以找到想要迁移的应用,然后选择“导出(预览)”。In http://web.powerapps.com, click or tap Apps, select the ellipses for the app you want to migrate, and then select Export (preview).

    选择导出

  2. 导出包页打开后,为包输入“名称”和“说明”。When the export package page opens, enter a Name and Description for the package.

    查看包详细信息

  3. 在“审阅包内容”部分中,可以选择添加评论或备注,或更改包导入期间将每个资源导入到目标环境的方式的设置。Within the ‘Review Package Content’ section you can optionally add comments or notes or change the setting for how each individual resource will be imported into the target environment during package import.

    配置包内容

  4. 选择“导出”后,将在几秒内开始下载包文件。When you are done select Export and the package file will begin downloading within a few seconds.

导入应用Importing an app

  1. http://web.powerapps.com 中,单击或点击“应用”,然后选择“导入包(预览)”。In http://web.powerapps.com, click or tap Apps, and then select Import package (preview).

    选择导入

  2. 选择“上传”,然后选择要导入的应用包文件。Select Upload and select the app package file that you want to import.

    选择包文件

  3. 上传包后,需要查看包内容并需要为标有红色图标的所有项输入其他内容(选择各个项的扳手图标并输入所需信息)。Once the package has been uploaded you will need to review the package contents and will need to provide additional input for any item marked with a red icon by selecting the wrench icon for each item and entering the required information.

    查看包内容

  4. 提供所有所需信息后,选择“导入”。Once you have provided all of the required information select Import.

    更新的打包内容

  5. 导入完成后,将自动重定向到一个页面(如下所示),提示导入操作是否已成功。When import completes you will be automatically redirected to a page (similar to the one below) that outlines whether or not the import operation was successful.

    查看导入结果

注意:如果在导入应用时选择了“更新”现有应用,新更改内容将被保存为此应用程序的草稿。NOTE If you are importing an app and chose to Update an existing app, the new changes will be saved as a draft of the applications. 需要发布这些更改才能让此应用程序的所有其他用户获取这些更改。You will need to publish those changes in order for them to be available all other users of the applications.

已知的限制Known limitations

限制Limitation 状态Status
根据报告,导入的应用包包含 3 个以上的资源时,需要几分钟的时间才能完成。Importing app packages that contains more than ~3 resources has been reported to take several minutes to complete. 这是一个已知问题,即将推出修复程序。This is a known issue and a fix will be rolled out soon.