在创建 Azure VM 时启用备份Enable backup when you create an Azure VM

使用 Azure 备份服务备份 Azure 虚拟机 (VM)。Use the Azure Backup service to back up Azure virtual machines (VMs). VM 是根据在备份策略中指定的计划备份的,恢复点是基于备份创建的。VMs are backed up according to a schedule specified in a backup policy, and recovery points are created from backups. 恢复点存储在恢复服务保管库中。Recovery points are stored in Recovery Services vaults.

本文详细介绍了在 Azure 门户中创建虚拟机 (VM) 时如何启用备份。This article details how to enable backup when you create a virtual machine (VM) in the Azure portal.

开始之前Before you start

  • 如果在创建 VM 时启用备份,请检查支持哪些操作系统。Check which operating systems are supported if you enable backup when you create a VM.

登录 AzureSign in to Azure

如果尚未登录到你的帐户,请先登录到 Azure 门户If you aren't already signed in to your account, sign in to the Azure portal.

创建配置了备份的 VMCreate a VM with Backup configured

  1. 在 Azure 门户中,单击“创建资源”。In Azure portal, click Create a resource.

  2. 在 Azure 市场中,单击“计算”,然后选择一个 VM 映像。In the Azure Marketplace, click Compute, and then select a VM image.

  3. 根据适用于 WindowsLinux 的说明设置 VM。Set up the VM in accordance with the Windows or Linux instructions.

  4. 在“管理”选项卡上,在“启用备份”中,单击“开启”。On the Management tab, in Enable backup, click On.

  5. Azure 备份将备份到恢复服务保管库。Azure Backup backups to a Recovery Services vault. 如果没有现有的保管库,请单击“新建”。Click Create New if you don't have an existing vault.

  6. 接受建议的保管库名称或自己指定名称。Accept the suggested vault name or specify your own.

  7. 指定或创建保管库将位于其中的资源组。Specify or create a resource group in which the vault will be located. 资源组保管库可以不同于 VM 资源组。The resource group vault can be different from the VM resource group.

    为 VM 启用备份

  8. 接受默认备份策略,或修改设置。Accept the default backup policy, or modify the settings.

    • 备份策略指定执行 VM 备份快照的频率和这些备份副本的保留期。A backup policy specifies how frequently to take backup snapshots of the VM, and how long to keep those backup copies.

    • 默认策略每天备份 VM 一次。The default policy backs up the VM once a day.

    • 你可以为 Azure VM 自定义你自己的备份策略以便每日或每周进行备份。You can customize your own backup policy for an Azure VM to take backups daily or weekly.

    • 详细了解 Azure VM 的备份注意事项。Learn more about backup considerations for Azure VMs.

    • 详细了解即时还原功能。Learn more about the instant restore functionality.

      默认备份策略

虚拟机的 Azure 备份资源组Azure Backup resource group for Virtual Machines

备份服务将创建一个单独的资源组 (RG) 而非 VM 的资源组来存储还原点集合 (RPC)。The Backup service creates a separate resource group (RG), different than the resource group of the VM to store the restore point collection (RPC). RPC 容纳托管 VM 的即时恢复点。The RPC houses the instant recovery points of managed VMs. 备份服务创建的资源组的默认命名格式为 AzureBackupRG_<Geo>_<number>The default naming format of the resource group created by the Backup service is: AzureBackupRG_<Geo>_<number>. 例如:AzureBackupRG_northeurope_1For example: AzureBackupRG_northeurope_1. 现在可以自定义 Azure 备份创建的资源组名称。You now can customize the Resource group name created by Azure Backup.

需要注意的要点:Points to note:

  1. 可以使用 RG 的默认名称,也可以根据公司要求对其进行编辑。You can either use the default name of the RG, or edit it according to your company requirements.
  2. 可以在创建 VM 备份策略时将 RG 名称模式作为输入提供。You provide the RG name pattern as input during VM backup policy creation. RG 名称应采用以下格式:<alpha-numeric string>* n <alpha-numeric string>The RG name should be of the following format: <alpha-numeric string>* n <alpha-numeric string>. “n”将替换为一个整数(从 1 开始),用于在第一个 RG 已满时进行横向扩展。'n' is replaced with an integer (starting from 1) and is used for scaling out if the first RG is full. 目前一个 RG 最多可以有 600 个 RPC。One RG can have a max of 600 RPCs today. 创建策略时选择名称Choose name when creating policy
  3. 该模式应遵循下面的 RG 命名规则,并且总长度不应超过允许的最大 RG 名称长度。The pattern should follow the RG naming rules below and the total length should not exceed the maximum allowed RG name length.
    1. 资源组名称只允许使用字母数字字符、句点、下划线、连字符和括号。Resource group names only allow alphanumeric characters, periods, underscores, hyphens, and parenthesis. 它们不能以句点结尾。They cannot end in a period.
    2. 资源组名称最多可包含 74 个字符,包括 RG 名称和后缀。Resource group names can contain up to 74 characters, including the name of the RG and the suffix.
  4. 第一个 <alpha-numeric-string> 是必需的,但“n”后面的第二个是可选的。The first <alpha-numeric-string> is mandatory while the second one after 'n' is optional. 这仅适用于你提供自定义名称的情况。This applies only if you give a customized name. 如果未在任何文本框中输入任何内容,则使用默认名称。If you don't enter anything in either of the textboxes, the default name is used.
  5. 如果需要,可以通过修改策略来编辑 RG 的名称。You can edit the name of the RG by modifying the policy if and when required. 如果更改了名称模式,将在新 RG 中创建新的 RP。If the name pattern is changed, new RPs will be created in the new RG. 但是,旧的 RP 仍将驻留在旧 RG 中,不会被删除,因为 RP 集合不支持资源移动。However, the old RPs will still reside in the old RG and won't be moved, as RP Collection does not support resource move. 最终,当点过期时,RP 会进行垃圾回收。Eventually the RPs will get garbage collected as the points expire. 修改策略时更改名称Change name when modifying policy
  6. 建议不要锁定为了供备份服务使用而创建的资源组。It is advised to not lock the resource group created for use by the Backup service.

若要使用 PowerShell 为虚拟机配置 Azure 备份资源组,请参阅在快照保留期间创建 Azure 备份资源组To configure the Azure Backup resource group for Virtual Machines using PowerShell, refer to Creating Azure Backup resource group during snapshot retention.

在创建 VM 后启动备份Start a backup after creating the VM

你的 VM 备份将根据备份策略运行。Your VM backup will run in accordance with your backup policy. 但是,我们建议你运行一个初始备份。However, we recommend that you run an initial backup.

创建 VM 后,请执行以下操作:After the VM is created, do the following:

  1. 在 VM 属性中,单击“备份”。In the VM properties, click Backup. VM 状态将保持为“初始备份挂起”,直到初始备份运行The VM status is Initial Backup Pending until the initial backup runs

  2. 单击“立即备份”来运行按需备份。Click Back up now to run an on-demand backup.

    运行按需备份

使用资源管理器模板部署一个受保护的 VMUse a Resource Manager template to deploy a protected VM

前面的步骤说明了如何使用 Azure 门户来创建虚拟机,以及使用恢复服务保管库来保护该虚拟机。The previous steps explain how to use the Azure portal to create a virtual machine and protect it in a Recovery Services vault. 若要快速部署一台或多台虚拟机并在恢复服务保管库中保护它们,请参阅模板部署 Windows VM 并启用备份To quickly deploy one or more VMs and protect them in a Recovery Services vault, see the template Deploy a Windows VM and enable backup.

后续步骤Next steps

现在,你已保护了你的 VM,请了解如何管理和还原它们。Now that you've protected your VM, learn how to manage and restore them.

如果遇到任何问题,请查看故障排除指南。If you encounter any issues, review the troubleshooting guide.