您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

将 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.jsOpen 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. 区域的代码是不带空格的区域名称,例如 West US 等同于 westusThe code for a region is the region name with no spaces, for example, West US is equal to westus.

    "type": "Microsoft.EventGrid/domains",
    "apiVersion": "2020-06-01",
    "name": "[parameters('domains_spegriddomain_name')]",
    "location": "westus",
    
  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.