将 Azure 存储帐户移到另一个区域Move an Azure Storage account to another region

若要移动某个存储帐户,请在另一个区域中创建该存储帐户的副本。To move a storage account, create a copy of your storage account in another region. 然后,使用 AzCopy 或其他所选工具将数据移到该帐户。Then, move your data to that account by using AzCopy, or another tool of your choice.

本文介绍如何执行以下操作:In this article, you'll learn how to:

  • 导出模板。Export a template.
  • 通过添加目标区域和存储帐户名称来修改模板。Modify the template by adding the target region and storage account name.
  • 部署该模板以创建新的存储帐户。Deploy the template to create the new storage account.
  • 配置新的存储帐户。Configure the new storage account.
  • 将数据移到新的存储帐户。Move data to the new storage account.
  • 删除源区域中的资源。Delete the resources in the source region.

先决条件Prerequisites

  • 确保帐户使用的服务和功能在目标区域中受支持。Ensure that the services and features that your account uses are supported in the target region.

  • 对于预览版功能,请确保你的订阅已列入目标区域的允许列表。For preview features, ensure that your subscription is whitelisted for the target region.

准备Prepare

若要开始,请导出然后修改某个资源管理器模板。To get started, export, and then modify a Resource Manager template.

导出模板Export a template

此模板包含描述存储帐户的设置。This template contains settings that describe your storage account.

若要使用 Azure 门户导出模板:To export a template by using Azure portal:

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

  2. 选择“所有资源”,然后选择你的存储帐户。Select All resources and then select your storage account.

  3. 选择“设置” > “导出模板”。 Select > Settings > Export template.

  4. 选择“导出模板”边栏选项卡中的“下载”。 Choose Download in the Export template blade.

  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 the .json files that comprise the template and scripts to deploy the template.

修改模板Modify the template

通过更改存储帐户名称和区域来修改模板。Modify the template by changing the storage account name and region.

若要使用 Azure 门户部署模板:To deploy the template by using Azure portal:

  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.

    Azure 资源管理器模板库

  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. template.json 文件中,通过设置存储帐户名称的默认值来为目标存储帐户命名。In the template.json file, name the target storage account by setting the default value of the storage account name. 此示例将存储帐户名称的默认值设置为 mytargetaccountThis example sets the default value of the storage account name to mytargetaccount.

    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccounts_mysourceaccount_name": {
            "defaultValue": "mytargetaccount",
            "type": "String"
        }
    },
    
    
  8. Edit the location property in the template.json file to the target region. This example sets the target region to chinanorth2.

    "resources": [{
         "type": "Microsoft.Storage/storageAccounts",
         "apiVersion": "2019-04-01",
         "name": "[parameters('storageAccounts_mysourceaccount_name')]",
         "location": "chinanorth2"
         }]          
    

    区域的代码是不带空格的区域名称,中国北部 2 = chinanorth2The code for a region is the region name with no spaces, China North 2 = chinanorth2.

移动Move

部署该模板,以在目标区域中创建新的存储帐户。Deploy the template to create a new storage account in the target region.

  1. 保存 template.json 文件。Save the template.json file.

  2. 输入或选择属性值:Enter or select the property values:

  • 订阅:选择 Azure 订阅。Subscription: Select an Azure subscription.

  • 资源组:选择“新建” 并为资源组指定名称。Resource group: Select Create new and give the resource group a name.

  • 位置:选择 Azure 位置。Location: Select an Azure location.

  1. 单击“我同意上述条款和条件”复选框,然后单击“选择购买”按钮。 Click the I agree to the terms and conditions stated above checkbox, and then click the Select Purchase button.

配置新的存储帐户Configure the new storage account

某些功能不会导出到模板,因此必须将其添加到新的存储帐户。Some features won't export to a template, so you'll have to add them to the new storage account.

下表列出了这些功能,以及有关将其添加到新存储帐户的指导。The following table lists these features along with guidance for adding them to your new storage account.

功能Feature 指南Guidance
生命周期管理策略Lifecycle management policies 管理 Azure Blob 存储生命周期Manage the Azure Blob storage lifecycle
静态网站Static websites 在 Azure 存储中托管静态网站Host a static website in Azure Storage
事件订阅Event subscriptions 响应 Blob 存储事件Reacting to Blob storage events
警报Alerts 使用 Azure Monitor 创建、查看和管理活动日志警报Create, view, and manage activity log alerts by using Azure Monitor

备注

如果为源存储帐户设置 CDN,只需将现有 CDN 的源更改为新帐户的主 blob 服务终结点(或主静态网站终结点)。If you set up a CDN for the source storage account, just change the origin of your existing CDN to the primary blob service endpoint (or the primary static website endpoint) of your new account.

将数据移到新的存储帐户Move data to the new storage account

AzCopy 是移动数据的首选工具。AzCopy is the preferred tool to move your data over. 此方法已针对性能进行优化。It's optimized for performance. 速度较快的原因之一是数据直接在存储服务器之间复制。因此,AzCopy 不会占用计算机的网络带宽。One way that it's faster, is that data is copied directly between storage servers, so AzCopy doesn't use the network bandwidth of your computer. 可在命令行或自定义脚本中使用 AzCopy。Use AzCopy at the command line or as part of a custom script. 请参阅 AzCopy 入门See Get started with AzCopy.

你还可以使用 Azure 数据工厂来移动数据。You can also use Azure Data Factory to move your data over. 它提供了直观的用户界面。It provides an intuitive user interface. 要使用 Azure 数据工厂,请参阅以下任意链接:To use Azure Data Factory, see any of these links:.


丢弃或清理Discard or clean up

部署后,如果你想要从头开始,可以删除目标存储帐户,然后重复本文中的准备移动部分所述的步骤。After the deployment, if you want to start over, you can delete the target storage account, and repeat the steps described in the Prepare and Move sections of this article.

若要提交更改并完成存储帐户的移动,请删除源存储帐户。To commit the changes and complete the move of a storage account, delete the source storage account.

若要使用 Azure 门户删除存储帐户:To remove a storage account by using the Azure portal:

  1. 在 Azure 门户中展开左侧的菜单打开服务菜单,然后选择“存储帐户”以显示存储帐户的列表。In the Azure portal, expand the menu on the left side to open the menu of services, and choose Storage accounts to display the list of your storage accounts.

  2. 找到要删除的目标存储帐户,并右键单击列表右侧的“更多”按钮 ( ... )。Locate the target storage account to delete, and right-click the More button (...) on the right side of the listing.

  3. 选择“删除”并确认。Select Delete, and confirm.

后续步骤Next steps

在本教程中,你已将一个 Azure 存储帐户从一个区域移到了另一个区域,并清理了源资源。In this tutorial, you moved an Azure storage account from one region to another and cleaned up the source resources. 若要详细了解如何在区域之间移动资源,以及如何在 Azure 中进行灾难恢复,请参阅:To learn more about moving resources between regions and disaster recovery in Azure, refer to: