
When it comes to cloud computing, Microsoft Azure is one of the leading cloud providers in the Infrastructure as a Service (IaaS) cloud model. Just as you will have your on-premises PC backed up either to external hard disk storage, and keep the backup drive offsite that’s at a place different from your business premises to avoid any disaster that may result in data loss or breach is the same way Azure also gives you the opportunity to backup your Virtual Machine in the cloud. You may be interested in learning about how to provision Azure Resources using Azure Az PowerShell Cmdlet from Cloud Shell. Also, learn about how to how to secure access to your Virtual Machine with Just-in-Time (JIT) VM Access. If you want to get started with Azure DevOps, see also how to build your first CI/CD Pipeline in Azure DevOps using ASP.Net Core Application.
In this article, I will explain how to back up Azure VMs with the Azure Backup service. You can back up Azure VMs using a couple of methods. This guide describes how to back up a single Azure VM directly from the VM menu settings.
Requirements for Initiating Azure VM Backup
Before you start, you need the following:
- Aan active subscription on Azure. If you don’t have one already, you can sign up for Azure free account here.
- Azure VM agent extension muzt be installed and running on the machine.
The point to note is if your Virtual Machine was created from an Azure Marketplace image, the agent will be running automatically immediately the VM deployment is complete. A situation where you will be required to manually installed the agent is if you create a custom VM, you migrate a machine from on-premises to Azure.
If you do need to install the VM agent manually, follow the instructions for Windows or Linux VMs. After the agent is installed, when you enable backup, Azure Backup installs the backup extension to the agent. It updates and patches the extension without user intervention.
Create VM from Azure Portal
- Sign into Azure Portal at portal.azure.com
- Type virtual machines in the search.
- Under Services, select Virtual machines.
- In the Virtual machines page, select Create then Virtual machine.
- In the Basics tab, under Project details, make sure the correct subscription is selected and then choose to Create new resource group. Type a name for your Resource Group. Here we use
vmbackupRg
6. Under Instance details, type the name for the Virtual machine and choose the Region of your choice. Choose Windows Server 2019 Datacenter for the Image and Standard_DS1_v2 for the Size. Leave the other defaults.
7. Click Review + Create
After the VM has been created successfully, click to go to resource
. This will open up the VM you just created.
Back up from Azure VM settings
- With VM still open down, select Backup on the VM menu
- In Recovery Services vault, do the following:
- If you already have a vault, select Select existing, and select a vault.
- If you don’t have a vault, select Create new. Specify a name for the vault. It’s created in the same region and resource group as the VM. You can’t modify these settings when you enable backup directly from the VM settings.
3. In Choose backup policy, do one of the following:
- Leave the default policy. This backs up the VM once a day at the time specified, and retains backups in the vault for 30 days.
- Select an existing backup policy if you have one.
- Create a new policy, and define the policy settings.
4. Click Edit this policy. Please note this is not compulsory as you choose to go with the default settings. You might just do this to enable you to explore the available backup policy options you can select based on your preference.
5. Select Enable Backup. This associates the backup policy with the VM.
The screenshot above shows the summary of the backup policy we defined. You can track the configuration progress in the portal notifications.
After the job completes, in the VM menu, select Backup. The page shows the backup status for the VM, information about recovery points, jobs running, and alerts issued.
After enabling backup, an initial backup runs. You can start the initial backup immediately, or wait until it starts in accordance with the backup schedule. Until the initial backup completes, Last backup status shows as Warning (Initial backup pending). To see when the next scheduled backup will run, select the backup policy name.
The below screen shows you the overview screen of the jobs and backup instances.
Run a VM backup immediately
- To run a backup immediately after the initial backup is complete, in the VM menu, select Backup > Backup now.
2. In Backup Now, use the calendar control to select until when the recovery point will be retained and OK.
As you can see from the screenshot, my next backup will occur on December 1st, 2021.
Congratulations, you have just succeeded in configuring backup for your Azure Virtual Machine.
One last thing you need to do is to clean up your environment to avoid incurring unnecessary charges from Azure. To do so, launch the Cloud Shell directly on the Azure Portal, Select the PowerShell option and run the PowerShell command shown below:
Remove-AzResourceGroup -Name YourResourceGroup
Remember Resource group is the logical folder where the VM and the Backup we created above are stored. So deleting it will delete everything at once for you.
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.