(Solution) VM Agent is unable to communicate with the Azure Backup Service for Linux VMs

4 Min. Read

Introduction

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.

The issue

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

VM agent is unable to communicate with the Azure Backup Service
UserErrorGuestAgentStatusUnavailable

If you came across a similar issue for Windows virtual machines, please check my earlier post on how to resolve it.

Troubleshooting

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:

  1. Cause 1: The agent is installed in the VM, but it’s unresponsive (for Windows VMs)
  2. Cause 2: The agent installed in the VM is out of date (for Linux VMs)
  3. Cause 3: The snapshot status can’t be retrieved, or a snapshot can’t be taken
  4. Cause 4: VM-Agent configuration options are not set (for Linux VMs)
  5. 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.

Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux
No resource extensions found

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:

Install walinuxagent
Install walinuxagent

To verify that your current Linux agent package version is installed, you can run the following command:

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

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:

cat /etc/waagent.conf

In the output, look for ‘AutoUpdate.Enabled=y‘ as shown in the figure below. If you see this output, then ‘Auto Update’ is enabled:

Check if 'AutoUpdate' is enabled for Linux Agent
Check if ‘AutoUpdate’ is enabled for Linux Agent

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:

waagent --version

For example, if you are running this command on Ubuntu 14.04, you’ll see the output as:

  • WALinuxAgent – 2.2.32.2 running on ubuntu 14.04
  • Python: 3.4.3
  • Goal State Agent: 2.2.54.2

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 walinuxagent.

Agent status is not ready
Agent status is not ready

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*
Linux Agent status and Agent version
Linux Agent status and Agent version

Then confirming that the OMS Agent for Linux is provisioned successfully.

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

After the OMS Linux VM agent was reported, I was able to enable the backup again and now the deployment completed successfully.

Configure Azure Backup Protection
Configure Azure Backup Protection

Hope this helps someone out there!

Summary

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.

-Charbel Nemnom-

Related Posts

Previous

Azure Defender for App Service in Azure Security Center

5 Most Critical M365 Vulnerabilities Revealed and How to Fix Them

Next

1 thought on “(Solution) VM Agent is unable to communicate with the Azure Backup Service for Linux VMs”

Leave a comment...

  1. Thanks a lot!

Let me know what you think, or ask a question...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Stay in Touch

Never miss out on your favorite posts and our latest announcements!

The content of this website is copyrighted from being plagiarized!

You can copy from the 'Code Blocks' in 'Black' by selecting the Code.

Please send your feedback to the author using this form for any 'Code' you like.

Thank you for visiting!