Manually install the Azure VM Agent

 

When you first deploy a Virtual Machine to Azure using the Gallery, you have the option of installing the VM Agent. You should always leave this box selected because it adds tremendous value.

image_thumb[8]

VM extensions can help you:

  • Modify security and identity features, such as resetting account values and using antimalware
  • Start, stop, or configure monitoring and diagnostics
  • Reset or install connectivity features, such as RDP and SSH
  • Diagnose, monitor, and manage your VMs
  • Backup your VMs with the new Azure VM level Backup feature (see my blog post here for more information on that feature announced March 26, 2015).

The agent allows you to add extensions to the VM, for more information, see this article:
https://msdn.microsoft.com/en-us/library/dn832621.aspx

You can manually download and install the VM Agent if it is not installed on the VM, see this article for more information:
https://msdn.microsoft.com/en-us/library/dn832621.aspx

The VM agent itself can be downloaded directly from (here) and is very small and takes seconds to install.

After manually installing the agent, it is necessary to set the ProvisionGuestAgent value to true using Powershell or a REST call. If you do not set this value after manually installing the VM Agent, the addition of the VM Agent is not detected properly.) The following code example shows how to do this using PowerShell where the $svc and $name arguments have already been determined

$vm = Get-AzureVM –serviceName $svc –Name $name
$vm.VM.ProvisionGuestAgent = $TRUE
Update-AzureVM –Name $name –VM $vm.VM –ServiceName $svc

Before you can run the powershell commands above, you first need to install the Azure Active Directory powershell module and then run the add-azureaccount command. Then to make sure you can see your VM’s, you can run get-azurevm.
image_thumb[9]

In this screenshot you can see I have two VM’s, one with the agent installed and one without it.

image_thumb[12]

So after manually installing the VM Agent, I can then run these commands to update Azure so that it knows the agent has been installed inside the guest VM:

$vm = Get-AzureVM –serviceName TCTCloudService –Name MyBackupTest
$vm.VM.ProvisionGuestAgent = $TRUE
Update-AzureVM –Name MyBackupTest –VM $vm.VM –ServiceName TCTCloudService

image_thumb[14]

Now when I check for guest agent status, I can now see the same for both VM’s:

image_thumb[16]

Leave a comment