Manage your Azure VM backups with Azure CLI 2.0 - Preview

已于 十月 3, 2017 发布

Program Manager II, Azure Backup

 

We are excited to announce that you can now use Azure CLI to easily manage your Windows and Linux Azure VM backups using Azure Backup. With Azure Backup, you can backup Azure Windows and Linux VMs, VMs running on Premium storage, and on Managed Disks as well with application-consistency. Now with CLI support, take advantage of CLI features such as smart defaults for most common operations, tab completion and pipe-able outputs to simply and quickly manage your VM backup and recovery operations. Azure Backup is supported with Azure CLI 2.0 only and is currently in preview.

How CLI will help

  • Cross-platform support: With Azure CLI, start managing your Azure VM backups from anywhere, irrespective of the platform you use.
  • Managing at scale: Easily handle operations at scale by including CLI commands in scripts and programs.
  • Automation: In conjunction with the command line tools, query on command outputs to identify important triggers and program subsequent actions. For example, backup health information can be programmatically retrieved, and subsequent operations can be initiated based on the health status.

Sample Scenarios:

Enabling Backup on a VM:

To protect a previously unprotected VMto a Recovery Services vault (within the same location and Resource group) with a default policy, use this command:  

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

For more information, refer to this quick start article to start backing up your VMs.

Restore:

You can restore files from VM backups without setting up any additional infrastructure and with a single command.

Use az backup recoverypoint list command to get recovery point name and then

az backup restore files mount-rp \
    --resource-group myResourceGroup \
    --vault-name myRecoveryServicesVault \
    --container-name myVM \
    --item-name myVM \
    --rp-name myRecoveryPointName

This will download a script to mount the recovery point. Run the script on the machine where you want to copy the files.

You can also restore disks from your VM backups and create your VMs from restored disks.

Management:

View your backup items’ health status using az backup item list command.

Azure Backup looks out for any configuration issues that might adversely impact VM backups and provides corresponding corrective measures. This is known as Backup pre-check. In CLI, this information is provided via “healthStatus” and “healthDetails” in az backup item list command’s JSON output. For example, in the image below, the health details section points out that the next backup might not be successful since the agent on the Linux machine is not up to date and it is recommended to have the agent upgraded.

cli-2-0-preview

You can use “--query” option along with az backup item list to extract health status and health details, and perform the recommended action, as suggested in the health details section, to ensure continuity of backups.

az backup item list \
   --resource-group myResourceGroup \
   --vault-name myRecoveryServicesVault \
   --container-name myVM \
   --query “[].properties.healthDetails \

Getting Started

Install or upgrade to Azure CLI 2.0 to start using backup CLI commands.

Just type “az backup -h” to get more information related to backup CLI commands and start to manage your Azure VM backups

Related links and additional content