I have one VM with a daily backup scheduled. Today I deleted a file in that VM and changed some configuration. I restored yesterday's data disk from my recovery service vault and changed the names of the recovered data disk.
Now I want to attach yesterday's restored backup to my existing VM. Is it possible?
If not then suppose I delete my VM but I keep its network interface card. I can create a new VM from restored VHDs using ARM templates but how can I assign an existing NIC to my new VM?
Also, I have added this VM to my domain controller. If I recreate the VM, do I need to add the new VM to the domain controller or will it work normally?
Now I want to attach yesterday's restored backup to my existing VM. is
it possible?
Yes, we can attach this restore disk to your existing VM, then we can find the disk in your existing VM.
I delete VM but I keep network interface card for the VM, now I can
create VM from restored VHD's using ARM templates but how to assign
exiting NIC in the new VM?
Yes, we can use PowerShell to create a VM with existing NIC and VHD, here is an example:
$rgname = "jason-newgroup"
$loc = "japaneast"
$vmsize = "Standard_DS1_v2"
$vmname = "jason-newtest2"
$vm = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize
$nic = Get-AzureRmNetworkInterface -Name "NICname" -ResourceGroupName $rgname
$nicId = $nic.Id
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nicId
$osDiskName = "jason-newtest"
$osDiskVhdUri = "https://jasonnewgroupdisks912.blob.core.windows.net/vhds/jason-newtest201681285042.vhd"
$vm = Set-AzureRmVMOSDisk -VM $vm -VhdUri $osDiskVhdUri -name $osDiskName -CreateOption attach -Windows
New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $vm
if I recreate the VM do I need to add new VM to domain controller or
will it work normally?
Yes, the new create VM (restore) will add to the domain controller, we don't need to add the VM to domain controller again.