- Introduction to VM Backups
So the next requirement of this exam is to talk about virtual machine posts. We can see on screen that the Microsoft Advisories actually recommend that we enable virtual machine backups. And so we’re going to go ahead and do that. We saw in a previous section that we could go into the Azure Recovery Vault, and there’s a way to enable backups from there. But we’re going to go into this virtual machine. So we’ve chosen one of our previously created virtual machines, and we’re going to go down to operations and backup.
Now, we can see here that we can either create a new recovery services vault or select an existing one. Since I don’t have a recovery services vault currently, I’m going to have to use this one. And remember, the recovery service vault has to be in the same region as the machine that is backing up, because you don’t want that data to be travelling so far around the world. I’m going to put that into the volume and put that into this resource group. Now, one of the key concepts of backups is that there is a default policy, called “daily Policy,” that you can always create or edit this policy.
So I’m going to go into the Create screen, and we can see here that there is a policy named Daily Policy. Let’s try. Well, for this virtual machine, we have the choice of daily backups or weekly backups. So let’s call this Daily Policy, and we’re going to remain a daily backup, but we’re going to want the backup to happen at 8:00 p.m. So I’m going to choose ham. I’m also going to make it 8:00 p.m. In my time zone, go down here and say Eastern Time.
And we can now also choose how many days we want to retain. So in this case, offering up the 8:00 p.m. backup will be retained for 180 days. That’s quite a lot of backups. Let’s change that to 90. We can also retain one backup per week. So when we’re doing backups of virtual machines, oftentimes, whenever you have a backup policy, you want daily backups. Let’s say you want daily backups for 30 days, but you also want to keep one weekly backup on Sundays. So we can then keep those twelve weeks, which is what threatens.
So we’ll keep the daily backup for 30 days, a weekly backup for three, and then a monthly backup on the first Sunday of every year. So now we have just one backup that’s happening, and we’re going to retain different levels of it. Okay. And then I won’t set up the yearly backup so I can say okay to this. So now we have a daily policy that has daily, weekly, and monthly backups that are retained by simply clicking enable backup.
At this point, we’ll modify this deployment, make sure the virtual machine has the backup extension, and create a Recovery Services Vault for us. And again, do the backups every day at 8:00 p.m. The Azure Portal actually makes it pretty simple to set up these backups. We’re going to actually cause a backup to happen. And then we’re going to show you how we can then restore from these backups. So come back for that.
2. VM Backup Jobs and Restores
So I actually clicked this Backup Now button on backupscreen to cause the backup to start, and we should be able to see that the job is in progress. So if I said “view all jobs,” I could see that the backup was configured successfully and now the backup is in progress. So we’ll just wait for it to go away. Now, hopefully that doesn’t take too long, but we’ll come back in ten or 15 minutes, depending on how long this backup takes, and we’ll do a restore from that point.
So, believe it or not, it actually took five and a half hours for the backup to run. I don’t know if this is normal for this VM, but that’s how long it took. Now you’ll see that the normal VM tried to start at 08:00, as I had scheduled it. And that backup actually failed because this backup was already running. So what we can do with backup is, if we go back to the backup, we will see that we have a section called “Points,” and we have an application already available for us.
So if we wanted to restore this virtual machine to 05:47 p.m., we could do that. The way that we do that is to choose three dots and then say “Restore VM.” Now we have two options. One is to create the virtual machine, which is an actual instance of a virtual machine. And the other is simply to store the disk, which contains the VHD files, in a network-consistent location.
So if you’ve got certain settings in your storage account (virtual network, service endpoints, etc.), It will restore the disc to the same storage account, and then you can start up the VM from there. But if you want to just get a copy of this virtual machine going, create a new machine. We won’t get into replacing the existing virtual machine if we want to have the disk.
Just go back to 540; let’s create a new one. So we’ll call it SJDM Four, the same resource group. It will use the same virtual network in the default subnet as well as the staging location. It’s going to use a temporary storage account in order to do some of its work.
And it needs to be a non-premium storage account since a typical hard disk is a spinning platter disk. So I’m going to choose this existing one, or I could, of course, create a new one. So if I click the okay button, it’s going to create a new virtual machine based on the backup from last night and with the properties. And just like that, we have a brand new, brand-virgin VM 4 that’s running in the same configuration, with the same operating system, and the same size as the VM. Go back up here. We can see that the VM is still there and still running. However, the VM Four is now operational. So we did, and we rebuilt.