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
![](https://hungryboysl.files.wordpress.com/2021/04/image-7.png?w=1024)
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
![](https://hungryboysl.files.wordpress.com/2021/04/image-8.png?w=982)
Get Azure VM Datadisk details
$Vm = Get-AzVM -ResourceGroupName AE-DEV-LINUX -Name LinuxVm01
Determine Datadisk lun details
$vm.StorageProfile.DataDisks
![](https://hungryboysl.files.wordpress.com/2021/04/image-9.png?w=926)
Specify the data disk lun numbers seperated with a comma
$disks = ("0")
$targetVault = Get-AzRecoveryServicesVault -ResourceGroupName AE-DEV-LINUX -Name LinuxRecovery
![](https://hungryboysl.files.wordpress.com/2021/04/image-10.png?w=1024)
Setting the vault content
Set-AzRecoveryServicesVaultContext -Vault $targetVault
![](https://hungryboysl.files.wordpress.com/2021/04/image-11.png?w=1024)
GetBackup policy details to a variable
$pol = Get-AzRecoveryServicesBackupProtectionPolicy -Name "Linux"
![](https://hungryboysl.files.wordpress.com/2021/04/image-12.png?w=1009)
Enable Protection
Enable-AzRecoveryServicesBackupProtection -Policy $pol -Name "LinuxVm01" -ResourceGroupName "AE-DEV-LINUX" -InclusionDisksList $disks -VaultId $targetVault.ID
![](https://hungryboysl.files.wordpress.com/2021/04/image-13.png?w=1024)
check the Backup status
$item= Get-AzRecoveryServicesBackupItem -BackupManagementType "AzureVM" -WorkloadType "AzureVM" -VaultId $targetVault.ID -FriendlyName "LinuxVm01"
![](https://hungryboysl.files.wordpress.com/2021/04/image-14.png?w=1024)
Backup OS Disk Only
To backup the OS disk only, we can achive this from GUi. Simply browse torecovery services vault.
![](https://hungryboysl.files.wordpress.com/2021/04/image-15.png?w=1024)
![](https://hungryboysl.files.wordpress.com/2021/04/image-16.png?w=1024)
Once you select the VM, you can simply tick the option to backup OS only
![](https://hungryboysl.files.wordpress.com/2021/04/image-17.png?w=859)
Or what you can do is powershell use the below parameer to exclude all data disks
![](https://hungryboysl.files.wordpress.com/2021/04/image-18.png?w=756)
Hope this helps someone (y)
Comments
Post a Comment