Understanding Azure Backup for Linux VMs

August 29, 2022 – Samuli Seppänen

Azure Backup is an Azure service that allows, among other things, backing up Windows and Linux VMs in Azure. The backups are essentially virtual machine snapshots, but backing up and/or restoring individual files is also possible. This article tries to explain how Azure Backup and Linux VMs interact and what is required for them to work. If you're interested in using Terraform to configure Azure Backup, please have a look at the Enabling Azure Backup on Linux VMs with Terraform article.

Azure <-> VM integrations such as Azure Backup depend on an agent (operating system service) running on the VM. In case of Linux systemd distros (like Ubuntu 20.04, below) this agent is called walinuxagent.service:

● walinuxagent.service - Azure Linux Agent
     Loaded: loaded (/lib/systemd/system/walinuxagent.service; enabled; vendor preset: enabled)
    Drop-In: /usr/lib/systemd/system/walinuxagent.service.d
             └─10-Slice.conf, 11-CPUAccounting.conf, 12-CPUQuota.conf
     Active: active (running) since Mon 2022-08-29 11:43:50 UTC; 37min ago
   Main PID: 507 (python3)
      Tasks: 7 (limit: 2285)
     Memory: 42.2M
        CPU: 3.466s
     CGroup: /azure.slice/walinuxagent.service
             ├─507 /usr/bin/python3 -u /usr/sbin/waagent -daemon
             └─557 python3 -u bin/WALinuxAgent-2.8.0.11-py2.7.egg -run-exthandlers

The walinuxagent is available as a package in the upstream repository, for example see the Ubuntu 20.04 variant here. The commonly-used base images in Azure Marketplace should have this package installed out of the box. The distro packages themselves are built from the Microsoft Azure Linux Agent source code.

Walinuxagent works together with the Azure Wireserver (168.63.129.16) to enable various Azure integrations such as DHCP, DNS and health status. Another use for the walinuxagent is installation of virtual machine extensions. Here the VMSnapshotLinux extension got installed as it was part of the "goal state" (=desired state) for walinuxagent when Azure Backup was enabled for the VM in Azure Portal:

Aug 29 11:53:44 testvm python3[557]: 2022-08-29T11:53:44.001323Z INFO ExtHandler Fetched a new incarnation for the WireServer goal state [incarnation 2]
--- snip ---
Aug 29 11:53:51 testvm python3[557]: 2022-08-29T11:53:51.307613Z INFO ExtHandler ExtHandler All extensions in the goal state have reached a terminal state: [('Microsoft.Azure.RecoveryServices.VMSnapshotLinux', 'success')]

If the virtual machine is down when backups are enabled then walinuxagent can't do its job. However, in all likelihood (untested) the Azure Wireserver will upload the new goal state to it when it starts up the next time and the VMSnapshotLinux extension gets installed correct.

Want to talk to an expert?

If you want to reach us, just send us a message or book a free call!
menucross-circle