4 min. Read

Azure backup you can protect and back up data to local servers, virtual machines, virtualized loads, SQL Server, SharePoint Server, and more.

Azure backup gives you the flexibility to choose and choose the information 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-term or long-term storage. And if necessary, you can restore virtual machines or individual files and folders in Azure or on site for free.

I moved recently Linux virtual machines from local to Azure, and during the project I need to protect these virtual machines after the transfer is done using Azure Backup.

When I enabled Azure Backup on a Linux VM, I noticed that the backup job failed with the following error message:

The VM agent is unable to communicate with Azure Backup

With the following error code: UserErrorGuestAgentStatusUnavailable

UserErrorGuestAgentStatusUnavailable

If you ran into a similar problem Windows virtual machines, check the previous post on how to solve it.

Once you have registered and scheduled a virtual machine for the backup service, Azure Backup begins work by communicating with a representative of the virtual machine to take an up-to-date snapshot. Many conditions may prevent the snapshot from starting. When the snapshot is not started, the backup job may fail.

According to Microsoft recommendations here, 5 possible causes can cause this problem:

  1. Reason 1: Agent is installed on a virtual machine but does not respond (for Windows virtual machines)
  2. Reason 2: Agent Installed on Virtual Machine Expired (for Linux Virtual Machines)
  3. Reason 3: Snapshot status cannot be retrieved or snapshot cannot be taken
  4. Reason 4: No VM-Agent configuration settings (for Linux virtual machines)
  5. Reason 5: The application management solution blocks the IaaSBcdrExtension.exe file

When I started removing the possible root causes according to the list above, I found that none of them were directly related to the problem.

However, reason number 4 gave me an insight that could be an agent issue. Because the Azure VM Agent is installed by default on all Linux and Windows virtual machines enabled from the Azure Gallery image. When you install an Azure gallery image from a portal, PowerShell, command line interface (CLI), Bicep, or Azure Resource Manager (ARM), the Azure VM Agent is also installed. And because that virtual machine has been migrated from the local environment, the Linux Azure VM agent will not be installed as shown below.

Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux
No resource extensions found

The Linux Azure VM Agent can be installed manually through the distribution information package. Manual installation may be required when creating a custom or moving virtual machine installed on Azure. If you want to install the Linux VM Agent manually, you need to confirm Minimum version support for virtual machine agents in Azure before continuing here. In addition, you must check and verify the approved Linux distributions in Azure Linux distros and versions are supported according to this article.

In my example, I am running Ubuntu 14.04.6 LTS.

To install and upgrade the Azure Linux Agent on a Linux virtual machine in Azure, you must already have:

  • Apparently a running Linux virtual machine in Azure.
  • Connect to that Linux virtual machine using SSH.

Log in to your Linux virtual machine using SSH and run the following commands:

# Update package cache via Bash
sudo apt-get -qq update

Then run the following command to install the latest version of the Linux agent package:

sudo apt-get install walinuxagent

Press Y Continue and install all the dependencies associated with this package as shown below:

Install walinuxagent
Install walinuxagent

To verify that your current version of the Linux Agent Package is installed, run the following command:

apt list --installed | grep walinuxagent
Check the current Linux package version
Check the current Linux package version

Next, make sure that Automatic Updates is enabled in the Linux agent. Because most agent or plug-in errors on Linux virtual machines are due to problems that affect the outdated virtual machine agent.

To enable automatic updating on Linux, run the following command:

sudo sed -i 's/# AutoUpdate.Enabled=n/AutoUpdate.Enabled=y/g' /etc/waagent.conf

To check if Automatic Updates is turned on, run the following command:

cat /etc/waagent.conf

Search the outputAutoUpdate.Enabled = y” as shown in the figure below. If you see this output, Automatic Updates is turned on:

Check to see if the Auto Agent update is enabled on the Linux Agent
Check to see if the Auto Agent update is enabled on the Linux Agent

Finally, you must restart the Linux Agent service based on the running Linux distro:

# 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 the installed version of Linux Agent, run the following command:

waagent --version

For example, if you use this command in Ubuntu 14.04, you will see the output as follows:

  • WALinuxAgent – 2.2.32.2 running on Ubuntu 14.04
  • Python: 3.4.3
  • Target State Representative: 2.2.54.2

Now, before you continue and re-enable Azure Backup, you must ensure that the status and version of the agent, including the virtual machine extension (OmsAgentForLinux), are reported to the Azure portal after installation. walinuxagent.

Agent status is not complete
Agent status is not complete

In the example, I had to wait a couple of hours for the agent status to be updated and reflected on the portal. However, you can force the virtual machine to update status by running the following PowerShell command:

Select-AzSubscription -SubscriptionId <YourSubscriptionID>
$vm = get-azvm -name <VMName> -resourcegroupname <RGName>
Update-AzVM -ResourceGroupName <RGName> -VM $vm*
Linux Agent Status and Agent Version
Linux Agent Status and Agent Version

Then confirm that the OMS agent for Linux has run successfully.

OMS Agent for Linux VM Extension
OMS Agent for Linux VM Extension

After the OMS Linux VM agent reported, I was able to re-enable the backup and now the installation was successful.

Configure Azure Backup Protection
Configure Azure Backup Protection

Hope this helps someone out there!

In this article, I showed you how to install the Linux Azure VM agent on a custom image with the Ubuntu 14.04 dr. If you have Red Hat / CentOS or other Linux distro, check out the official Microsoft guide here.

Want to learn more about Azure Backup and how to create a hybrid cloud service solution using SC DPM and Azure backup server? Check out my recently published book: Microsoft System Center Data Protection Manager Cookbook.

__
Thanks for locking my blog.

If you have any questions or feedback, please leave a comment.

-Charbel Nemnom-

LEAVE A REPLY

Please enter your comment!
Please enter your name here