将逻辑应用资源移到其他 Azure 资源组、区域或订阅Move logic app resources to other Azure resource groups, regions, or subscriptions

若要将逻辑应用或相关资源迁移到另一个 Azure 资源组、区域或订阅,可以使用多种方式,例如使用 Azure 门户、Azure PowerShell、Azure CLI 和 REST API。To migrate your logic app or related resources to another Azure resource group, region, or subscription, you have various ways to complete these tasks, such as the Azure portal, Azure PowerShell, Azure CLI, and REST API. 在移动资源之前,请查看以下注意事项:Before you move resources, review these considerations:

  • 只能在 Azure 资源组或订阅之间移动特定的逻辑应用资源类型You can move only specific logic app resource types between Azure resource groups or subscriptions.

  • 检查可在 Azure 订阅中和每个 Azure 区域中使用的逻辑应用资源数限制Check the limits on the number of logic app resources that you can have in your Azure subscription and in each Azure region. 当不同订阅或资源组所在的区域相同时,这些限制会影响到能否移动特定的资源类型。These limits affect whether you can move specific resource types when the region stays the same across subscriptions or resource groups. 例如,对于每个 Azure 区域中的每个 Azure 订阅,只能使用一个免费层集成帐户。For example, you can have only one Free tier integration account for each Azure region in each Azure subscription.

  • 移动资源时,Azure 将创建新的资源 ID。When you move resources, Azure creates new resource IDs. 因此,请确保改用新的 ID,并更新与所要移动的资源关联的任何脚本或工具。So, make sure that you use the new IDs instead and update any scripts or tools that are associated with the moved resources.

  • 在订阅、资源组或区域之间迁移逻辑应用之后,必须重新创建或重新授权任何需要 Open Authentication (OAuth) 的连接。After you migrate logic apps between subscriptions, resource groups, or regions, you must recreate or reauthorize any connections that require Open Authentication (OAuth).

先决条件Prerequisites

  • 创建要移动的逻辑应用或集成帐户时所用的同一个 Azure 订阅The same Azure subscription that was used to create the logic app or integration account that you want to move

  • 拥有移动和设置所需资源的资源所有者权限。Resource owner permissions to move and set up the resources that you want. 详细了解基于角色的访问控制 (RBAC)Learn more about role-based access control (RBAC).

在订阅之间移动资源Move resources between subscriptions

若要将某个资源(例如逻辑应用或集成帐户)移到另一个 Azure 订阅,可以使用 Azure 门户、Azure PowerShell、Azure CLI 或 REST API。To move a resource, such as a logic app or integration account, to another Azure subscription, you can use the Azure portal, Azure PowerShell, Azure CLI, or REST API. 以下步骤使用 Azure 门户。当资源的区域相同时,可以使用此方法。These steps cover the Azure portal, which you can use when the resource's region stays the same. 有关其他步骤和常规准备工作,请参阅将资源移到新的资源组或订阅For other steps and general preparation, see Move resources to a new resource group or subscription.

  1. Azure 门户中,找到并选择要移动的逻辑应用资源。In the Azure portal, find and select the logic app resource that you want to move.

  2. 在该资源的“概述”页上的“订阅”旁边,选择“更改”链接。 On the resource's Overview page, next to Subscription, select the change link.

  3. 在“移动资源”页上,选择要移动的逻辑应用资源和任何相关资源。On the Move resources page, select the logic app resource and any related resources that you want to move.

  4. 在“订阅”列表中选择目标订阅。From the Subscription list, select the destination subscription.

  5. 在“资源组”列表中选择目标资源组。From the Resource group list, select the destination resource group. 若要创建不同的资源组,请选择“创建新组”。Or, to create a different resource group, select Create a new group.

  6. 为了确认你已知道在使用新资源 ID 更新与所要移动的资源关联的任何脚本或工具之前,这些脚本或工具不会正常运行,请选中确认框,然后选择“确定”。To confirm your understanding that any scripts or tools that are associated with the moved resources won't work until you update them with the new resource IDs, select the confirmation box, and then select OK.

在资源组之间移动资源Move resources between resource groups

若要将某个资源(例如逻辑应用或集成帐户)移到另一个 Azure 资源组,可以使用 Azure 门户、Azure PowerShell、Azure CLI 或 REST API。To move a resource, such as a logic app, or integration account, to another Azure resource group, you can use the Azure portal, Azure PowerShell, Azure CLI, or REST API. 以下步骤使用 Azure 门户。当资源的区域相同时,可以使用此方法。These steps cover the Azure portal, which you can use when the resource's region stays the same. 有关其他步骤和常规准备工作,请参阅将资源移到新的资源组或订阅For other steps and general preparation, see Move resources to a new resource group or subscription.

在组之间实际移动资源之前,可以测试是否能够成功地将资源移到另一个组。Before actually moving resources between groups, you can test whether you can successfully move your resource to another group. 有关详细信息,请参阅验证移动For more information, see Validate your move.

  1. Azure 门户中,找到并选择要移动的逻辑应用资源。In the Azure portal, find and select the logic app resource that you want to move.

  2. 在该资源的“概述”页上的“资源组”旁边,选择“更改”链接。 On the resource's Overview page, next to Resource group, select the change link.

  3. 在“移动资源”页上,选择要移动的逻辑应用资源和任何相关资源。On the Move resources page, select the logic app resource and any related resources that you want to move.

  4. 在“资源组”列表中选择目标资源组。From the Resource group list, select the destination resource group. 若要创建不同的资源组,请选择“创建新组”。Or, to create a different resource group, select Create a new group.

  5. 为了确认你已知道在使用新资源 ID 更新与所要移动的资源关联的任何脚本或工具之前,这些脚本或工具不会正常运行,请选中确认框,然后选择“确定”。To confirm your understanding that any scripts or tools that are associated with the moved resources won't work until you update them with the new resource IDs, select the confirmation box, and then select OK.

在区域之间移动资源Move resources between regions

若要将逻辑应用移到不同的区域,可用的选项取决于逻辑应用的创建方式。When you want to move a logic app to a different region, your options depend on the way that you created your logic app. 根据选择的选项,必须在逻辑应用中重新创建或重新授权连接。Based on the option that you choose, you must recreate or reauthorize the connections in your logic app.

  • 在 Azure 门户中,在新区域中重新创建逻辑应用,并重新配置工作流设置。In the Azure portal, recreate the logic app in the new region and reconfigure the workflow settings. 为了节省时间,可将源应用中基础工作流定义和连接复制到目标应用。To save time, you can copy the underlying workflow definition and connections from the source app to the destination app. 若要查看逻辑应用附带的“代码”,请在逻辑应用设计器工具栏上选择“代码视图”。To view the "code" behind a logic app, on the Logic App Designer toolbar, select Code view.

  • 使用 Visual Studio 和适用于 Visual Studio 的 Azure 逻辑应用工具,可以在 Azure 门户中以 Azure 资源管理器模板的形式打开和下载逻辑应用By using Visual Studio and the Azure Logic Apps Tools for Visual Studio, you can open and download your logic app from the Azure portal as an Azure Resource Manager template. 此模板基本上已做好部署的准备,包含逻辑应用的资源定义(包括工作流本身和连接)。This template is mostly ready for deployment and includes the resource definitions for your logic app, including the workflow itself, and connections. 该模板还声明了在部署时要使用的值的参数。The template also declares parameters for the values to use at deployment. 这样,你便可以根据自己的需求,更轻松地更改逻辑应用的部署位置和方式。That way, you can more easily change where and how you deploy the logic app, based on your needs. 若要指定部署的位置和其他必要信息,可以使用单独的参数文件。To specify the location and other necessary information for deployment, you can use a separate parameters file.

  • 如果使用持续集成 (CI) 和持续交付 (CD) 工具(例如 Azure DevOps 中的 Azure Pipelines)创建并部署了逻辑应用,则可以使用这些工具将应用部署到另一区域。If you created and deployed your logic app by using continuous integration (CI) and continuous delivery (CD) tools, such as Azure Pipelines in Azure DevOps, you can deploy your app to another region by using those tools.

有关逻辑应用部署模板的详细信息,请参阅以下主题:For more information about deployment templates for logic apps, see these topics:

某些 Azure 资源(例如 Azure 中的本地数据网关资源)所在的区域可能不同于使用这些资源的逻辑应用所在的区域。Some Azure resources, such as on-premises data gateway resources in Azure, can exist in a region that differs from the logic apps that use those resources. 但是,其他 Azure 资源(例如链接的集成帐户)必须与逻辑应用位于同一区域。However, other Azure resources, such as linked integration accounts, must exist in the same region as your logic apps. 根据具体的方案,确保逻辑应用可以访问预期位于同一区域中的资源。Based on your scenario, make sure that your logic apps can access the resources that your apps expect to exist in the same region.

例如,若要将某个逻辑应用链接到某个集成帐户,则这两个资源必须位于同一区域。For example, to link a logic app to an integration account, both resources must exist in the same region. 在灾难恢复等方案中,你通常希望集成帐户使用相同配置的和项目。In scenarios such as disaster recovery, you usually want integration accounts that have the same configuration and artifacts. 在其他方案中,你可能需要让集成帐户使用不同的配置和项目。In other scenarios, you might need integration accounts with different configurations and artifacts.

具有相同 Azure 订阅和相同 Azure Active Directory 租户的连接器作者与用户可以看到 Azure 逻辑应用中的自定义连接器。Custom connectors in Azure Logic Apps are visible to the connectors' authors and users who have the same Azure subscription and the same Azure Active Directory tenant. 在部署逻辑应用的同一区域中,可以使用这些连接器。These connectors are available in the same region where logic apps are deployed. 有关详细信息,请参阅在组织中共享自定义连接器For more information, see Share custom connectors in your organization.

从 Visual Studio 获取的模板仅包含逻辑应用及其连接的资源定义。The template that you get from Visual Studio includes only the resource definitions for your logic app and its connections. 因此,如果逻辑应用使用其他资源(例如集成帐户,以及合作伙伴、协议和架构等 B2B 项目),则必须使用 Azure 门户导出该集成帐户的模板。So, if your logic app uses other resources, for example, an integration account and B2B artifacts, such as partners, agreements, and schemas, you must export that integration account's template by using the Azure portal. 此模板包含集成帐户和项目的资源定义。This template includes the resource definitions for both the integration account and artifacts. 但是,该模板尚未完全参数化。However, the template isn't fully parameterized. 因此,必须手动参数化要用于部署的值。So, you must manually parameterize the values that you want to use for deployment.

导出集成帐户的模板Export templates for integration accounts

  1. Azure 门户中,找到并打开你的集成帐户。In the Azure portal, find and open your integration account.

  2. 在集成帐户菜单中的“设置”下,选择“导出模板”。 On your integration account's menu, under Settings, select Export template.

  3. 在工具栏上选择“下载”,然后保存该模板。On the toolbar, select Download, and save the template.

  4. 打开并编辑该模板,以参数化所需的部署值。Open and edit the template to parameterize the necessary values for deployment.

后续步骤Next steps

将 Azure 资源移到新资源组或订阅中Move Azure resources to new resource groups or subscriptions