Azure 备份的 VM 快照 Linux 扩展VM Snapshot Linux extension for Azure Backup

Azure 备份支持从本地将工作负载备份到云以及将云资源备份到恢复服务保管库。Azure Backup provides support for backing up workloads from on-premises to cloud and backing up cloud resources to Recovery Services vault. Azure 备份使用 VM 快照扩展即可获取 Azure 虚拟机的应用程序一致性备份,而无需关闭 VM。Azure Backup uses VM snapshot extension to take an application consistent backup of the Azure virtual machine without the need to shutdown the VM. Azure 将 VM 快照 Linux 扩展作为 Azure 备份服务的一部分发布并提供支持。VM Snapshot Linux extension is published and supported by Azure as part of Azure Backup service. Azure 备份将安装该扩展,使其作为启用备份后触发的首个计划备份的一部分。Azure Backup will install the extension as part of first scheduled backup triggered post enabling backup. 本文档详细介绍适用于 VM 快照扩展的受支持平台、配置和部署选项。This document details the supported platforms, configurations, and deployment options for the VM Snapshot extension.

只有对于非托管 VM,VMSnapshot 扩展才会出现在 Azure 门户中。The VMSnapshot extension appears in the Azure portal only for non-managed VMs.

先决条件Prerequisites

操作系统Operating system

有关支持的操作系统的列表,请参阅 Azure 备份支持的操作系统For a list of supported operating systems, please refer to Operating Systems supported by Azure Backup

扩展架构Extension schema

以下 JSON 显示 VM 快照扩展的架构。The following JSON shows the schema for the VM snapshot extension. 该扩展需要任务 ID(它标识了在 VM 上已触发快照的备份作业)、状态 Blob URI(其中写入快照操作状态)、快照的计划开始时间、日志 Blob URI(写入与快照任务对应的日志),以及表示 VM 磁盘和元数据的 objstr。The extension requires the task ID - this identifies the backup job which triggered snapshot on the VM, status blob uri - where status of the snapshot operation is written, scheduled start time of the snapshot, logs blob uri - where logs corresponding to snapshot task are written, objstr- representation of VM disks and meta data. 由于应将这些设置视为敏感数据,因此它应存储在受保护的设置配置中。Because these settings should be treated as sensitive data, it should be stored in a protected setting configuration. Azure VM 扩展的受保护设置数据已加密,并且只能在目标虚拟机上解密。Azure VM extension protected setting data is encrypted, and only decrypted on the target virtual machine. 请注意,建议仅将这些设置作为备份作业的一部分从 Azure 备份服务传递。Please note that these settings are recommended to be passed from Azure Backup service only as part of Backup job.

{
  "type": "extensions",
  "name": "VMSnapshot",
  "location":"<myLocation>",
  "properties": {
    "publisher": "Microsoft.RecoveryServices",
    "type": "VMSnapshotLinux",
    "typeHandlerVersion": "1.9",
    "autoUpgradeMinorVersion": true,
    "settings": {
      "locale":"<location>",
      "taskId":"<taskId used by Azure Backup service to communicate with extension>",
      "commandToExecute": "snapshot",
      "commandStartTimeUTCTicks": "<scheduled start time of the snapshot task>",
      "vmType": "microsoft.compute/virtualmachines"
    },
    "protectedSettings": {
      "objectStr": "<blob SAS uri representation of VM sent by Azure Backup service to extension>",
      "logsBlobUri": "<blob uri where logs of command execution by extension are written to>",
      "statusBlobUri": "<blob uri where status of the command executed by extension is written>"
    }
  }
}

属性值Property values

名称Name 值/示例Value / Example 数据类型Data Type
apiVersionapiVersion 2015-06-152015-06-15 datedate
taskIdtaskId e07354cf-041e-4370-929f-25a319ce8933_1e07354cf-041e-4370-929f-25a319ce8933_1 stringstring
commandStartTimeUTCTickscommandStartTimeUTCTicks 6.36458E+176.36458E+17 stringstring
区域设置locale zh-cnen-us stringstring
objectStrobjectStr sas uri 数组的编码 - "blobSASUri": ["https://sopattna5365.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc201652903941.vhd?sv=2014-02-14&sr=b&sig=TywkROXL1zvhXcLujtCut8g3jTpgbE6JpSWRLZxAdtA%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna8461.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc-20160629-122418.vhd?sv=2014-02-14&sr=b&sig=5S0A6YDWvVwqPAkzWXVy%2BS%2FqMwzFMbamT5upwx05v8Q%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna8461.blob.core.chinacloudapi.cn/bootdiagnostics-vmubuntu1-deb58392-ed5e-48be-9228-ff681b0cd3ee/vmubuntu1404ltsc-20160629-122541.vhd?sv=2014-02-14&sr=b&sig=X0Me2djByksBBMVXMGIUrcycvhQSfjYvqKLeRA7nBD4%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna5365.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc-20160701-163922.vhd?sv=2014-02-14&sr=b&sig=oXvtK2IXCNqWv7fpjc7TAzFDpc1GoXtT7r%2BC%2BNIAork%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna5365.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc-20170705-124311.vhd?sv=2014-02-14&sr=b&sig=ZUM9d28Mvvm%2FfrhJ71TFZh0Ni90m38bBs3zMl%2FQ9rs0%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw"]Encoding of sas uri array- "blobSASUri": ["https://sopattna5365.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc201652903941.vhd?sv=2014-02-14&sr=b&sig=TywkROXL1zvhXcLujtCut8g3jTpgbE6JpSWRLZxAdtA%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna8461.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc-20160629-122418.vhd?sv=2014-02-14&sr=b&sig=5S0A6YDWvVwqPAkzWXVy%2BS%2FqMwzFMbamT5upwx05v8Q%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna8461.blob.core.chinacloudapi.cn/bootdiagnostics-vmubuntu1-deb58392-ed5e-48be-9228-ff681b0cd3ee/vmubuntu1404ltsc-20160629-122541.vhd?sv=2014-02-14&sr=b&sig=X0Me2djByksBBMVXMGIUrcycvhQSfjYvqKLeRA7nBD4%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna5365.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc-20160701-163922.vhd?sv=2014-02-14&sr=b&sig=oXvtK2IXCNqWv7fpjc7TAzFDpc1GoXtT7r%2BC%2BNIAork%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw", "https://sopattna5365.blob.core.chinacloudapi.cn/vhds/vmubuntu1404ltsc-20170705-124311.vhd?sv=2014-02-14&sr=b&sig=ZUM9d28Mvvm%2FfrhJ71TFZh0Ni90m38bBs3zMl%2FQ9rs0%3D&st=2017-11-09T14%3A23%3A28Z&se=2017-11-09T17%3A38%3A28Z&sp=rw"] stringstring
logsBlobUrilogsBlobUri https://seapod01coord1exsapk732.blob.core.chinacloudapi.cn/bcdrextensionlogs-d45d8a1c-281e-4bc8-9d30-3b25176f68ea/sopattna-vmubuntu1404ltsc.v2.Logs.txt?sv=2014-02-14&sr=b&sig=DbwYhwfeAC5YJzISgxoKk%2FEWQq2AO1vS1E0rDW%2FlsBw%3D&st=2017-11-09T14%3A33%3A29Z&se=2017-11-09T17%3A38%3A29Z&sp=rw stringstring
statusBlobUristatusBlobUri https://seapod01coord1exsapk732.blob.core.chinacloudapi.cn/bcdrextensionlogs-d45d8a1c-281e-4bc8-9d30-3b25176f68ea/sopattna-vmubuntu1404ltsc.v2.Status.txt?sv=2014-02-14&sr=b&sig=96RZBpTKCjmV7QFeXm5IduB%2FILktwGbLwbWg6Ih96Ao%3D&st=2017-11-09T14%3A33%3A29Z&se=2017-11-09T17%3A38%3A29Z&sp=rw stringstring

模板部署Template deployment

可使用 Azure Resource Manager 模板部署 Azure VM 扩展。Azure VM extensions can be deployed with Azure Resource Manager templates. 但是,建议通过在虚拟机上启用备份,将 VM 快照扩展添加到虚拟机。However, the recommended way of adding a VM snapshot extension to a virtual machine is by enabling backup on the virtual machine. 可以通过资源管理器模板来实现此操作。This can be achieved through a Resource Manager template. 在虚拟机上启用备份的示例资源管理器模板可以在 Azure 快速入门库中找到。A sample Resource Manager template that enables backup on a virtual machine can be found on the Azure Quick Start Gallery.

Azure CLI 部署Azure CLI deployment

可以使用 Azure CLI 在虚拟机上启用备份。The Azure CLI can be used to enable backup on a virtual machine. 启用备份之后,第一个计划的备份作业将在 VM 上安装 VM 快照扩展。Post enable backup, first scheduled backup job will install the Vm snapshot extension on the VM.

az backup protection enable-for-vm \
    --resource-group myResourceGroup \
    --vault-name myRecoveryServicesVault \
    --vm myVM \
    --policy-name DefaultPolicy

故障排除和支持Troubleshoot and support

故障排除Troubleshoot

有关扩展部署状态的数据可以从 Azure 门户和使用 Azure CLI 进行检索。Data about the state of extension deployments can be retrieved from the Azure portal, and by using the Azure CLI. 若要查看给定 VM 的扩展部署状态,请使用 Azure CLI 运行以下命令。To see the deployment state of extensions for a given VM, run the following command using the Azure CLI.

az vm extension list --resource-group myResourceGroup --vm-name myVM -o table

扩展执行输出将记录到以下文件:Extension execution output is logged to the following file:

/var/log/waagent.log

错误代码及其含义Error codes and their meanings

故障排除信息可在 Azure VM 备份故障排除指南中找到。Troubleshooting information can be found on the Azure VM backup troubleshooting guide.

支持Support

如果对本文中的任何观点存在疑问,可以联系 Azure 支持上的 Azure 专家。If you need more help at any point in this article, you can contact the Azure experts on the Azure support. 或者,也可以提出 Azure 支持事件。Alternatively, you can file an Azure support incident. 请转到 Azure 支持站点提交请求。Go to the Azure support site and submit your request. 有关使用 Azure 支持的信息,请阅读 Azure 支持常见问题For information about using Azure Support, read the Azure support FAQ.