Hey Folks
Recently Microsoft has announched that, Azure now supports VM Selective backups.
What is this selective backup??. This will allow the admins/customers to backup only the selected disks in a VM to Azure backup. But at the moment we can only perform the following scnearios
Example
We have a Linux VM which has OS Disk and 2 data disks as mention below

What we can do is
- Backup All Data disks (Typical option)
- Backup only the OS disk
- Backup OS Disk + Disk 1
- Backup OS Disk + Disk 2
What we cannot do is back up on the data disks without the OS disk.
I will talk about option 2 and 3 ( 4 is same as 3). Basically I will be covering the new options. Alos on this to note, at the moment option 3 only can be set from powershell. There is no GUI option for it.
Backup OS Disk + Data Disk 1
Get VM Disk Details
Get-AzDisk -ResourceGroupName AE-DEV-LINUX

Get Azure VM Datadisk details
$Vm = Get-AzVM -ResourceGroupName AE-DEV-LINUX -Name LinuxVm01
Determine Datadisk lun details
$vm.StorageProfile.DataDisks

Specify the data disk lun numbers seperated with a comma
$disks = ("0")
$targetVault = Get-AzRecoveryServicesVault -ResourceGroupName AE-DEV-LINUX -Name LinuxRecovery

Setting the vault content
Set-AzRecoveryServicesVaultContext -Vault $targetVault

GetBackup policy details to a variable
$pol = Get-AzRecoveryServicesBackupProtectionPolicy -Name "Linux"

Enable Protection
Enable-AzRecoveryServicesBackupProtection -Policy $pol -Name "LinuxVm01" -ResourceGroupName "AE-DEV-LINUX" -InclusionDisksList $disks -VaultId $targetVault.ID

check the Backup status
$item= Get-AzRecoveryServicesBackupItem -BackupManagementType "AzureVM" -WorkloadType "AzureVM" -VaultId $targetVault.ID -FriendlyName "LinuxVm01"

Backup OS Disk Only
To backup the OS disk only, we can achive this from GUi. Simply browse torecovery services vault.


Once you select the VM, you can simply tick the option to backup OS only

Or what you can do is powershell use the below parameer to exclude all data disks

Hope this helps someone (y)
Comments
Post a Comment