将 Azure VM 备份到恢复服务保管库中Back up Azure VMs in a Recovery Services vault

本文介绍如何使用 Azure 备份服务将 Azure VM 备份到恢复服务保管库中。This article describes how to back up Azure VMs in a Recovery Services vault, using the Azure Backup service.

在本文中,学习如何:In this article, you learn how to:

  • 准备 Azure VM。Prepare Azure VMs.
  • 创建保管库。Create a vault.
  • 发现 VM 并配置备份策略。Discover VMs and configure a backup policy.
  • 为 Azure VM 启用备份。Enable backup for Azure VMs.
  • 运行初始备份。Run the initial backup.


本文将会介绍如何设置保管库以及选择要备份的 VM。This article describes how to set up a vault and select VMs to back up. 若要备份多个 VM,则本文的内容会有所帮助。It's useful if you want to back up multiple VMs. 或者,可以直接从 VM 设置备份单个 Azure VMAlternatively, you can back up a single Azure VM directly from the VM settings.

开始之前Before you start

  • 查看 Azure VM 备份体系结构。Review the Azure VM backup architecture.
  • 了解 Azure VM 备份和备份扩展。Learn about Azure VM backup, and the backup extension.

此外,在某些情况下,还需要完成几项操作:In addition, there are a couple of things that you might need to do in some circumstances:

  • 在 VM 上安装 VM 代理:Azure 备份通过为在计算机上运行的 Azure VM 代理安装一个扩展来备份 Azure VM。Install the VM agent on the VM: Azure Backup backs up Azure VMs by installing an extension to the Azure VM agent running on the machine. 如果 VM 是从 Azure 市场映像创建的,则代理已安装并正在运行。If your VM was created from an Azure marketplace image, the agent is installed and running. 如果创建了自定义 VM 或者迁移了本地计算机,则可能需要手动安装代理If you create a custom VM, or you migrate an on-premises machine, you might need to install the agent manually.

创建保管库Create a vault

保管库可以存储备份以及在不同时间创建的恢复点,并可以存储与备份的计算机相关联的备份策略。A vault stores backups and recovery points created over time, and stores backup policies associated with backed up machines. 按如下所述创建保管库:Create a vault as follows:

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

  2. 在搜索框中键入“恢复服务”。 In search, type Recovery Services. 在“服务”下,单击“恢复服务保管库” 。Under Services, click Recovery Services vaults.


  3. 在“恢复服务保管库”菜单中,单击“+添加” 。In Recovery Services vaults menu, click +Add.

    创建恢复服务保管库步骤 2

  4. 在“恢复服务保管库”中,键入一个易记名称用于标识保管库。 In Recovery Services vault, type in a friendly name to identify the vault.

    • 名称对于 Azure 订阅需要是唯一的。The name needs to be unique for the Azure subscription.
    • 该名称可以包含 2 到 50 个字符。It can contain 2 to 50 characters.
    • 名称必须以字母开头,只能包含字母、数字和连字符。It must start with a letter, and it can contain only letters, numbers, and hyphens.
  5. 选择要在其中创建保管库的 Azure 订阅、资源组和地理区域。Select the Azure subscription, resource group, and geographic region in which the vault should be created. 然后单击“创建” 。Then click Create.

    • 创建保管库可能需要一段时间。It can take a while for the vault to be created.
    • 可以在门户的右上区域中监视状态通知。Monitor the status notifications in the upper-right area of the portal.

创建保管库后,它会显示在恢复服务保管库列表中。After the vault is created, it appears in the Recovery Services vaults list. 如果未看到创建的保管库,请选择“刷新” 。If you don't see your vault, select Refresh.



Azure 备份现在允许自定义由 Azure 备份服务创建的资源组名称。Azure Backup now allows customization of the resource group name created by the Azure Backup service. 有关详细信息,请参阅虚拟机的 Azure 备份资源组For more information, see Azure Backup resource group for Virtual Machines.

修复存储复制Modify storage replication

默认情况下,保管库使用异地冗余存储 (GRS)By default, vaults use geo-redundant storage (GRS).

按如下所述修改存储复制类型:Modify storage replication type as follows:

  1. 在新保管库的“设置” 部分单击“属性” 。In the new vault, click Properties in the Settings section.

  2. 在“属性” 中的“备份配置” 下,单击“更新” 。In Properties, under Backup Configuration, click Update.

  3. 选择存储复制类型,然后单击“保存” 。Select the storage replication type, and click Save.



在保管库经过设置并且包含备份项之后,无法修改存储复制类型。You can't modify the storage replication type after the vault is set up and contains backup items. 若要修改,需要重新创建保管库。If you want to do this you need to recreate the vault.

应用备份策略Apply a backup policy

配置保管库的备份策略。Configure a backup policy for the vault.

  1. 在保管库的“概述”部分,单击“+备份” 。In the vault, click +Backup in the Overview section.


  2. 在“备份目标” > “工作负荷在哪里运行?”中,选择“Azure”。 In Backup Goal > Where is your workload running? select Azure. 在“要备份哪些内容?”中,选择“虚拟机” > “确定”。 In What do you want to back up? select Virtual machine > OK. 这会在保管库中注册 VM 扩展。This registers the VM extension in the vault.


  3. 在“备份策略”中,选择要与保管库关联的策略。 In Backup policy, select the policy that you want to associate with the vault.

    • 默认策略每天备份 VM 一次。The default policy backs up the VM once a day. 每日备份将保留 30 天。The daily backups are retained for 30 days. 即时恢复快照将保留两天。Instant recovery snapshots are retained for two days.

    • 如果不想要使用默认策略,请选择“新建”,然后按下一过程中所述创建自定义策略。 If you don't want to use the default policy, select Create New, and create a custom policy as described in the next procedure.


  4. 在“选择虚拟机”中,选择要使用该策略备份的 VM。 In Select virtual machines, select the VMs you want to back up using the policy. Then click OK.

    • 随后将验证选定的 VM。The selected VMs are validated.

    • 只能选择与保管库位于同一区域中的 VM。You can only select VMs in the same region as the vault.

    • 只能在单个保管库中备份 VM。VMs can only be backed up in a single vault.


  5. 在“备份”中,单击“启用备份”。 In Backup, click Enable backup. 这会将策略部署到保管库和 VM,并在 Azure VM 上运行的 VM 代理中安装备份扩展。This deploys the policy to the vault and to the VMs, and installs the backup extension on the VM agent running on the Azure VM.


启用备份后:After enabling backup:

  • 无论 VM 是否在运行,备份服务都会安装备份扩展。The Backup service installs the backup extension whether or not the VM is running.
  • 初始备份将根据备份计划运行。An initial backup will run in accordance with your backup schedule.
  • 运行备份时,请注意:When backups run, note that:
    • 正在运行的 VM 最有可能捕获应用程序一致的恢复点。A VM that's running have the greatest chance for capturing an application-consistent recovery point.
    • 但是,即使 VM 已关闭,也仍会将其备份。However, even if the VM is turned off it's backed up. 此类 VM 称为脱机 VM。Such a VM is known as an offline VM. 在这种情况下,恢复点是崩溃一致的。In this case, the recovery point will be crash-consistent.
  • 不需要显式出站连接即可备份 Azure VM。Explicit outbound connectivity is not required to allow backup of Azure VMs.

创建自定义策略Create a custom policy

如果已选择创建新的备份策略,请填写策略设置。If you selected to create a new backup policy, fill in the policy settings.

  1. 在“策略名称”中指定有意义的名称。 In Policy name, specify a meaningful name.

  2. 在“备份计划”中指定何时创建备份。 In Backup schedule, specify when backups should be taken. 可为 Azure VM 创建每日或每周备份。You can take daily or weekly backups for Azure VMs.

  3. 在“即时还原”中,指定要在本地将用于即时还原的快照保留多长时间。 In Instant Restore, specify how long you want to retain snapshots locally for instant restore.

    • 还原时,已备份的 VM 磁盘将通过网络从存储复制到恢复存储位置。When you restore, backed up VM disks are copied from storage, across the network to the recovery storage location. 使用即时还原时,可以利用在执行备份作业期间创建的存储于本地的快照,而无需等待将备份数据传输到保管库。With instant restore, you can leverage locally-stored snapshots taken during a backup job, without waiting for backup data to be transferred to the vault.
    • 可将用于即时还原的快照保留一到五天。You can retain snapshots for instant restore for between one to five days. 默认设置为两天。Two days is the default setting.
  4. 在“保留期”中,指定要将每日或每周备份点保留多长时间。 In Retention range, specify how long you want to keep your daily or weekly backup points.

  5. 在“保留每月备份点”中,指定是否要保留每日或每周备份的每月备份。 In Retention of monthly backup point, specify whether you want to keep a monthly backup of your daily or weekly backups.

  6. 单击“确定” 保存策略。Click OK to save the policy.



Azure 备份不支持根据 Azure VM 备份的夏令时时差自动调整时钟。Azure Backup doesn't support automatic clock adjustment for daylight-saving changes for Azure VM backups. 发生时间变化时,可根据需要手动修改备份策略。As time changes occur, modify backup policies manually as required.

触发初始备份Trigger the initial backup

初始备份将根据计划运行,但你可以按如下所述手动运行:The initial backup will run in accordance with the schedule, but you can run it immediately as follows:

  1. 在保管库菜单中,单击“备份项” 。In the vault menu, click Backup items.
  2. 在“备份项” 中,单击“Azure 虚拟机” 。In Backup Items, click Azure Virtual Machine.
  3. 在“备份项” 列表中,单击省略号 (...)。In the Backup Items list, click the ellipses (...).
  4. 单击“立即备份” 。Click Backup now.
  5. 在“立即备份”中,使用日历控件选择恢复点的最后保留日期 。In Backup Now, use the calendar control to select the last day that the recovery point should be retained. Then click OK.
  6. 监视门户通知。Monitor the portal notifications. 可以在保管库仪表板 >“备份作业” > “进行中”监视作业进度。 You can monitor the job progress in the vault dashboard > Backup Jobs > In progress. 创建初始备份可能需要一些时间,具体取决于 VM 的大小。Depending on the size of your VM, creating the initial backup may take a while.

验证备份作业状态Verify Backup job status

对于每个 VM 备份,备份作业详细信息包含两个阶段:“快照” 阶段和跟随其后的“将数据传输到保管库” 阶段。The Backup job details for each VM backup consist of two phases, the Snapshot phase followed by the Transfer data to vault phase.
“快照”阶段保证随同磁盘一起存储的恢复点可用于“即时还原” ,并且可用时间最长可达 5 天,具体视用户配置的快照保留期而定。The snapshot phase guarantees the availability of a recovery point stored along with the disks for Instant Restores and are available for a maximum of five days depending on the snapshot retention configured by the user. “将数据传输到保管库”阶段在保管库中创建一个恢复点,以实现长期保留。Transfer data to vault creates a recovery point in the vault for long-term retention. 仅当“快照”阶段完成后,“将数据传输到保管库”阶段才启动。Transfer data to vault only starts after the snapshot phase is completed.


有两个“子任务” 正在后端运行,一个子任务用于前端备份作业,该备份作业可从“备份作业”详细信息边栏选项卡进行查看,如下所示 :There are two Sub Tasks running at the backend, one for front-end backup job that can be checked from the Backup Job details blade as given below:


“将数据传输到保管库” 阶段可能需要数日才能完成,具体取决于磁盘大小、每个磁盘的改动情况以及其他若干因素。The Transfer data to vault phase can take multiple days to complete depending on the size of the disks, churn per disk and several other factors.

作业状态可能因以下情况而异:Job status can vary depending on the following scenarios:

快照Snapshot 将数据传输到保管库Transfer data to vault 作业状态Job Status
已完成Completed 正在进行In progress 正在进行In progress
已完成Completed 已跳过Skipped 已完成Completed
已完成Completed 已完成Completed 已完成Completed
已完成Completed 已失败Failed 已完成,但出现警告Completed with warning
已失败Failed 已失败Failed 已失败Failed

现在,借助此功能,对于相同的 VM,两个备份可以并行运行,但是,无论处于哪个阶段(“快照”、“将数据传输到保管库”),都只能有一个子任务处于运行状态。Now with this capability, for the same VM, two backups can run in parallel, but in either phase (snapshot, transfer data to vault) only one sub task can be running. 因此,对于进行中的备份作业导致了第二天备份失败的情况,就会通过此分离功能加以避免。So in scenarios were a backup job in progress resulted in the next day’s backup to fail will be avoided with this decoupling functionality. 如果以前某天的备份作业处于正在进行的状态,那么当“将数据传输到保管库” 阶段已跳过时,次日的备份快照可以被完成。Subsequent day’s backups can have snapshot completed while Transfer data to vault skipped if an earlier day’s backup job is in progress state. 在保管库中创建的增量恢复点将从在该保管库中创建的最后一个恢复点捕获所有的改动。The incremental recovery point created in the vault will capture all the churn from the last recovery point created in the vault. 不会对用户产生任何成本影响。There is no cost impact on the user.

可选步骤Optional steps

安装 VM 代理Install the VM agent

Azure 备份通过为在计算机上运行的 Azure VM 代理安装一个扩展来备份 Azure VM。Azure Backup backs up Azure VMs by installing an extension to the Azure VM agent running on the machine. 如果 VM 是从 Azure 市场映像创建的,则代理已安装并正在运行。If your VM was created from an Azure Marketplace image, the agent is installed and running. 如果创建了自定义 VM 或者迁移了本地计算机,则可能需要根据下表中的摘要手动安装代理。If you create a custom VM, or you migrate an on-premises machine, you might need to install the agent manually, as summarized in the table.

VMVM 详细信息Details
WindowsWindows 1.下载并安装代理 MSI 文件。1. Download and install the agent MSI file.

2.使用管理员权限在计算机上进行安装。2. Install with admin permissions on the machine.

3.验证安装。3. Verify the installation. 在 VM 上的“C:\WindowsAzure\Packages”中,右键单击“WaAppAgent.exe” > 选择“属性”。 In C:\WindowsAzure\Packages on the VM, right-click WaAppAgent.exe > Properties. 在“详细信息”选项卡上,“产品版本”应为 2.6.1198.718 或更高。 On the Details tab, Product Version should be 2.6.1198.718 or higher.

若要更新代理,请确保没有备份操作正在运行,并重新安装代理If you're updating the agent, make sure that no backup operations are running, and reinstall the agent.
LinuxLinux 使用分发版包存储库中的 RPM 或 DEB 包安装代理。Install by using an RPM or a DEB package from your distribution's package repository. 这是安装和升级 Azure Linux 代理的首选方法。This is the preferred method for installing and upgrading the Azure Linux agent. 所有 认可的分发版提供商 会将 Azure Linux 代理包集成到其映像和存储库。All the endorsed distribution providers integrate the Azure Linux agent package into their images and repositories. GitHub 上提供了该代理,但我们不建议从此处安装。The agent is available on GitHub, but we don't recommend installing from there.

若要更新代理,请确保没有备份操作正在运行,并更新二进制文件。If you're updating the agent, make sure no backup operations are running, and update the binaries.


Azure 备份现在支持使用 Azure 虚拟机备份解决方案进行选择性磁盘备份和还原。Azure Backup now supports selective disk backup and restore using the Azure Virtual Machine backup solution.

如今,Azure 备份支持使用虚拟机备份解决方案将 VM 中的所有磁盘(操作系统和数据)备份到一起。Today, Azure Backup supports backing up all the disks (Operating System and data) in a VM together using the Virtual Machine backup solution. 使用排除磁盘功能,可以选择从 VM 的多个数据磁盘中备份一个或多个数据磁盘。With exclude-disk functionality, you get an option to backup one or a few from the many data disks in a VM. 这样就提供了一个高效且经济的针对备份和还原需求的解决方案。This provides an efficient and cost-effective solution for your backup and restore needs. 每个恢复点都包含备份操作中包含的磁盘的数据,因此还可以在还原操作过程中从给定的恢复点还原部分磁盘。Each recovery point contains data of the disks included in the backup operation, which further allows you to have a subset of disks restored from the given recovery point during the restore operation. 这适用于从快照和保管库进行的还原。This applies to restore both from the snapshot and the vault.

若要注册预览版,请向 AskAzureBackupTeam@microsoft.com 发送邮件**To sign up for the preview, write to us at AskAzureBackupTeam@microsoft.com**

后续步骤Next steps