将 Azure 事件网格域移动到另一个区域Move Azure Event Grid domains to another region

由于多方面的原因,你可能需要将资源移动到另一个区域。You might want to move your resources to another region for a number of reasons. 例如,为了利用新的 Azure 区域,为了满足内部策略和监管要求,或者,为了应对容量规划要求。For example, to take advantage of a new Azure region, to meet internal policy and governance requirements, or in response to capacity planning requirements.

下面是本文介绍的概要步骤:Here are the high-level steps covered in this article:

  • 将域资源导出到 Azure 资源管理器模板。Export the domain resource to an Azure Resource Manager template.

    重要

    域资源和域中的主题会导出到该模板。The domain resource and topics in the domain are exported to the template. 对域主题的订阅不会导出。Subscriptions to domain topics aren't exported.

  • 使用该模板将域部署到目标区域。Use the template to deploy the domain to the target region.

  • 在目标区域中手动创建对域主题的订阅。Create subscriptions for domain topics manually in the target region. 在当前区域中将域导出到模板时,对域主题的订阅不会导出。When you exported the domain to a template in the current region, subscriptions for domain topics aren't exported. 因此,请在目标区域中创建域和域主题后创建这些订阅。So, create them after the domain and domain topics are created in the target region.

  • 验证部署Verify the deployment . 将一个事件发送到该域中的某个域主题,并验证是否会调用与该订阅关联的事件处理程序。Send an event to a domain topic in the domain and verify the event handler associated with the subscription is invoked.

  • 若要完成移动,请从源区域中删除域。To complete the move , delete domain from the source region.

先决条件Prerequisites

准备Prepare

若要开始操作,请导出用于该域的资源管理器模板。To get started, export a Resource Manager template for the domain.

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 在搜索栏中,键入“事件网格域”,然后从结果列表中选择“事件网格域” 。In the search bar, type Event Grid Domains , and select Event Grid Domains from the results list.

    搜索并选择事件网格域

  3. 选择要导出到资源管理器模板的域。Select the domain that you want to export to a Resource Manager template.

    选择域

  4. 在“事件网格域”页上,选择左侧菜单中“设置”下的“导出模板”,然后选择工具栏上的“下载” 。On the Event Grid Domain page, select Export Template under Settings on the left menu, and then select Download on the toolbar.

    导出模板 -> 下载

    重要

    域和域主题会导出。Domain and domain topics are exported. 对域主题的订阅不会导出。Subscriptions for domain topics aren't exported. 因此,需要在移动域主题之后为域主题创建订阅。So, you need to create subscriptions for domain topics after you move domain topics.

  5. 找到从门户下载的 .zip 文件,并将该文件解压缩到所选的文件夹。Locate the .zip file that you downloaded from the portal, and unzip that file to a folder of your choice. 此 zip 文件包含模板和参数 JSON 文件。This zip file contains template and parameters JSON files.

  6. 在你选择的编辑器中打开 template.json。Open the template.json in an editor of your choice.

  7. 将域资源的 location 更新为目标区域或位置。Update location for the domain resource to the target region or location. 若要获取位置代码,请参阅 Azure 位置To obtain location codes, see Azure locations. 区域的代码是不带空格的区域名称,例如 China North 等同于 chinanorthThe code for a region is the region name with no spaces, for example, China North is equal to chinanorth.

    "type": "Microsoft.EventGrid/domains",
    "apiVersion": "2020-06-01",
    "name": "[parameters('domains_spegriddomain_name')]",
    "location": "chinanorth",
    
  8. 保存该模板。Save the template.

重新创建Recreate

在目标区域中部署该模板以创建域和域主题。Deploy the template to create the domain and domain topics in the target region.

  1. 在 Azure 门户中,选择“创建资源”。In the Azure portal, select Create a resource .
  2. 在“搜索市场”中键入“模板部署”,然后按 ENTERIn Search the Marketplace , type template deployment , and then press ENTER .
  3. 选择“模板部署”。Select Template deployment .
  4. 选择“创建” 。Select Create .
  5. 选择“在编辑器中生成自己的模板”。Select Build your own template in the editor .
  6. 选择“加载文件”,然后按说明加载在上一部分下载的 template.json 文件。Select Load file , and then follow the instructions to load the template.json file that you downloaded in the last section.
  7. 选择“保存”以保存该模板。Select Save to save the template.
  8. 在“自定义部署”页上执行以下步骤:On the Custom deployment page, follow these steps:
    1. 选择 Azure 订阅。Select an Azure subscription .

    2. 选择目标区域中现有的资源组,或者创建一个资源组。Select an existing resource group in the target region or create one.

    3. 对于“区域”,请选择目标区域。For Region , select the target region. 如果选择了现有资源组,则此设置为只读。If you selected an existing resource group, this setting is read-only.

    4. 对于“域名”,请为该域输入新名称。For the domain name , enter a new name for the domain.

    5. 选择“查看 + 创建” 。Select Review + create .

      部署模板

    6. 模板的验证成功之后,请选择页面底部的“创建”来部署资源。After the validation of the template succeeds, select Create at the bottom of the page to deploy the resource.

    7. 部署成功后,请选择“转到资源组”,以导航到资源组页。After the deployment succeeds, select Go to resource group to navigate to the resource group page. 确认资源组中存在某个域。Confirm that there's a domain in the resource group. 选择该域。Select the domain. 确认该域中存在域主题。Confirm that there are domain topics in the domain.

丢弃或清理Discard or clean up

若要完成移动,请删除源区域中的域。To complete the move, delete the domain in the source region.

如果需要重新开始,请删除目标区域中的域,并重复本文的准备重新创建部分中的步骤。If you want to start over, delete the domain in the target region, and repeat steps in the Prepare and Recreate sections of this article.

若要通过使用 Azure 门户来删除域,请执行以下步骤:To delete a domain by using the Azure portal:

  1. 在 Azure 门户顶部的搜索窗口中,键入“事件网格域”,然后从搜索结果中选择“事件网格域”。In the search window at the top of Azure portal, type Event Grid Domains , and select Event Grid Domains from search results.
  2. 选择要删除的域,然后从工具栏中选择“删除”。Select the domain to delete, and select Delete from the toolbar.
  3. 在确认页上,输入资源组的名称,然后选择“删除”。On the confirmation page, enter the name of the resource group, and select Delete .

若要通过使用 Azure 门户删除包含域的资源组,请执行以下步骤:To delete the resource group that contains the domain by using the Azure portal:

  1. 在 Azure 门户顶部的搜索窗口中,键入“资源组”,然后从搜索结果中选择“资源组” 。In the search window at the top of Azure portal, type Resource groups , and select Resource groups from search results.
  2. 选择要删除的资源组,然后从工具栏中选择“删除”。Select the resource group to delete, and select Delete from the toolbar.
  3. 在确认页上,输入资源组的名称,然后选择“删除”。On the confirmation page, enter the name of the resource group, and select Delete .

后续步骤Next steps

你已经了解了如何将事件网格域从一个区域移动到另一个区域。You learned how to move an Event Grid domain from one region to another region. 若要了解如何跨区域移动系统主题、自定义主题和合作伙伴命名空间,请参阅以下文章。See the following articles for moving system topics, custom topics, and partner namespaces across regions.

若要详细了解在 Azure 中如何在区域之间移动资源以及如何进行灾难恢复,请参阅以下文章:将资源移动到新的资源组或订阅To learn more about moving resources between regions and disaster recovery in Azure, see the following article: Move resources to a new resource group or subscription.