In This Article
Azure Backup allows you to protect and back up your data for on-premises servers, virtual machines, virtualized workloads, SQL Server, SharePoint Server, and more.
Azure Backup gives you the flexibility to pick and choose the data you want to protect, for as long as you want to protect it. Azure Backup is designed to be cost-effective whether you’re interested in short or long-term retention. And, you can restore virtual machines or individual files and folders—in Azure or on-premises—as needed, for free.
I was recently migrating Linux virtual machines from on-premises to Azure, and during the scope of that project, I need to protect those VMs after the migration is completed using the Azure Backup service.
When I enabled Azure Backup for the Linux VM, I noticed that the backup job is failing with the following error message:
VM agent is unable to communicate with the Azure Backup Service
With the following error code: UserErrorGuestAgentStatusUnavailable
If you came across a similar issue for Windows virtual machines, please check my earlier post on how to resolve it.
After you register and schedule a VM for the Backup service, Azure Backup initiates the job by communicating with the VM agent to take a point-in-time snapshot. Many conditions might prevent the snapshot from being triggered. When a snapshot isn’t triggered, the backup job might fail.
According to Microsoft recommendations noted here, 5 potential causes could cause this issue to happen:
- Cause 1: The agent is installed in the VM, but it’s unresponsive (for Windows VMs)
- Cause 2: The agent installed in the VM is out of date (for Linux VMs)
- Cause 3: The snapshot status can’t be retrieved, or a snapshot can’t be taken
- Cause 4: VM-Agent configuration options are not set (for Linux VMs)
- Cause 5: Application control solution is blocking IaaSBcdrExtension.exe
Finding the cause
After I started eliminating the potential root causes following the list above, I noticed that none of them is related directly to my issue.
However, cause number 4 gave me an insight that could be an agent issue. Because the Azure VM Agent is installed by default on any Linux and Windows virtual machine deployed from an Azure Gallery image. When deploying an Azure gallery image from the Portal, PowerShell, Command Line Interface (CLI), Bicep, or an Azure Resource Manager (ARM) template, the Azure VM Agent is also be installed. And since this particular VM is migrated from an on-premises environment, then the Linux Azure VM agent is not installed as shown in the figure below.
Fixing the issue
The Linux Azure VM agent can be manually installed through a distribution repository package. Manual installation may be necessary when creating a custom or migrating a virtual machine deployed in Azure. To manually install the Linux VM Agent, you need to verify the Minimum version support for virtual machine agents in Azure before proceeding here. Additionally, you need to check the endorsed Linux distributions on Azure and make sure your Linux distros and versions are supported as noted in this article.
In my example, I am running Ubuntu 14.04.6 LTS.
To install and update your Azure Linux Agent on a Linux VM in Azure, you must already have:
- Obviously a running Linux VM in Azure.
- A connection to that Linux VM using SSH.
Login to your Linux VM using SSH and run the following commands:
# Update package cache via Bash sudo apt-get -qq update
Then install the latest Linux agent package version by running the following command:
sudo apt-get install walinuxagent
Press Y to continue and install all the dependencies related to this package as shown in the figure below:
To verify that your current Linux agent package version is installed, you can run the following command:
apt list --installed | grep walinuxagent
Next is to make sure that ‘Auto Update’ is enabled for the Linux Agent. Because most agent-related or extension-related failures for Linux VMs are caused by issues that affect an outdated VM agent.
To enable ‘Auto Update’ on your Linux VM, please run the following command:
sudo sed -i 's/# AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf
To check whether ‘Auto Update’ is enabled, you can run the following command:
In the output, look for ‘AutoUpdate.Enabled=y‘ as shown in the figure below. If you see this output, then ‘Auto Update’ is enabled:
Finally, you need to restart the Linux agent service based on your Linux distro that you are running:
# Restart waagengt service for Ubuntu 14.04 sudo initctl restart walinuxagent # Restart waagengt service for Ubuntu 16.04 / 17.04 sudosystemctl restart walinuxagent.service
To check which Linux Agent version is installed, run the following command:
For example, if you are running this command on Ubuntu 14.04, you’ll see the output as:
- WALinuxAgent – 126.96.36.199 running on ubuntu 14.04
- Python: 3.4.3
- Goal State Agent: 188.8.131.52
Enable Azure Backup
Now before you proceed and enable Azure Backup again, you need to make sure that the agent status and version including the VM extension (OmsAgentForLinux) is reporting in the Azure Portal after installing
In my example, I had to wait a couple of hours for the Agent status to get updated and reflecting in the portal. However, you can force to update the state of the VM by running the following PowerShell command:
Select-AzSubscription -SubscriptionId <YourSubscriptionID> $vm = get-azvm -name <VMName> -resourcegroupname <RGName> Update-AzVM -ResourceGroupName <RGName> -VM $vm*
Then confirming that the OMS Agent for Linux is provisioned successfully.
After the OMS Linux VM agent reported, I was able to enable the backup again and now the deployment completed successfully.
Hope this helps someone out there!
In this article, I showed you how to install the Linux Azure VM agent on your custom image running the Ubuntu 14.04 distro. If you are running Red Hat / CentOS or other Linux distros, please check the official guide from Microsoft here.
Do you want to learn more about Azure Backup and how to create a hybrid-cloud backup solution using SC DPM and Azure Backup Server? Make sure to check my recently published book: Microsoft System Center Data Protection Manager Cookbook.
Thank you for reading my blog.
If you have any questions or feedback, please leave a comment.