azure icon indicating copy to clipboard operation
azure copied to clipboard

Restore VM from Backup

Open Klaas- opened this issue 1 year ago • 1 comments

SUMMARY

I would like the possiblity to restore a virtual machine from backup via ansible. Primary usecase is I want to automate recovery tests and restoring the actual backup is a crucial part of that :)

There two types of restores:

  1. Replace VM, this will replace an existing VM with an older version of the same VM (most common scenario I would say). It will however not replace the disks, but create new disks and reconfigure VM to use the new ones
  2. Create new VM from backup, this means you can use your backup to create a new VM from it. I've included this for feature parity with the portal, but my interest is primarily in scanario 1)

I think this also needs an addition to the azure.azcollection.azure_rm_backupazurevm_info to list all available backups, currently it only supplies information about the last backup.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

I think this could be part of azure.azcollection.azure_rm_backupazurevm or become a new module

ADDITIONAL INFORMATION
azure.azcollection.azure_rm_backupazurevm:
  state: restore
  backup_id: "{{ id_of_backup_you_want_to_restore }}"

Klaas- avatar Aug 30 '24 08:08 Klaas-

List of available backups is coming from here: https://learn.microsoft.com/en-us/rest/api/backup/recovery-points/list?view=rest-backup-2024-04-01&tabs=Python#code-try-0

Klaas- avatar Aug 30 '24 14:08 Klaas-