VM Agent and Extensions – Part 1

One of the new features announced recently for Windows Azure Infrastructure Services is the VM Agent. The VM Agent is a light weight process intended to bootstrap additional solutions, offered both by Microsoft and partners, for configuring, managing, and accelerating Virtual Machines. The goal of this blog is to describe about VM Agent and how it relates to VM Extensions, their benefits and usage. While part 1 of the blog focuses on enabling VM Agent and Extensions on new Azure VMs, part 2 focuses on extending this to existing VMs.

What are VM Extensions?

Before discussing about VMExtensions, let’s look at how additional software gets onto IaaS Virtual Machines today. Some of the common ways for installing & managing software on the VMs are 1) Preinstalling it on the disk before creating a VM 2) Logging onto the VM and manually installing it from the there. 3)Installing via remote PowerShell etc 4) Update Management and  health/status reporting using a combination of tools.

This is where VM Extensions simplifies VM Management.

  • VM Extensions are software components that extend the VM functionality and  simplify various VM management operations.
  • Multiple VM extensions can be installed on any given VM and they can be added, updated and removed from the VM independent of the lifecycle of the VM.
  • The status of the VM and its extensions can be viewed and managed from a single location.

Here is a view of the VM with extensions:

Who authors these Extensions?

The extensions are authored, published and supported by Publishers who are registered with Microsoft. Every extension will carry the publisher information. This blog is focused on how to add Extensions to a VM but in future blogs we’ll talk about the extension publishing process.

What are the current available Extensions?

Currently there are two IaaS VM  Extensions published by Microsoft – BGInfo and VMAccess.

BGInfo  :  BGInfo is an extension that writes useful server information to the desktop as a wallpaper. If you create VMs from Portal you already get this extension.

Once Bginfo is enabled, the VM desktop  has a wallpaper like this:

If you want to add it manually there is handy cmdlet Set-AzureVMBGInfoExtension. Details of using this cmdlet can be found using the MSDN documentation here.

  • Enabling BGIno:

Get-AzureVM –ServiceName –Name | Set-AzureVMBGInfoExtension | Update-AzureVM

  • Disabling BGInfo:

Read the extension ReferenceName and Version from the output of the following cmdlet:

Get-AzureVM –ServiceName –Name | Get-AzureVMBGInfoExtension

Get-AzureVM –ServiceName –Name | Set-AzureVMBGInfoExtension –ReferenceName –Version –Disable | Update-AzureVM

Logoff/Login is required sometimes to disable Bginfo.

Note : If you are already a Bginfo user, then you might want to note that the Extension Version of BGfino does not support modifying Bginfo settings on the VM yet.

VMAccess:   If you have previously lost your IaaS VM password, you know there is no way to recover it. Similarly if the RDP settings of the VM are broken there is no easy way to fix it. VMAccess addresses these two scenarios. For password VMAccess provides a mechanism for the user to get back on the VM by resetting the password and also user name. Once you are able to log in with this reset password, it is recommended to change the password.

Details of using cmdlet can be found in the MSDN documentation here.

Here are the scenarios for VMAccess.

  • Reset password :

Get-AzureVM –ServiceName –Name | Set-AzureVMAccessExtension –UserName –Password |Update-AzureVM

Specify a new value for ‘UserName’ if you want to change the username, if not use the existing one.

  • Fix RDP Settings:

Get-AzureVM –ServiceName –Name | Set-AzureVMAccessExtension |Update-AzureVM

Calling Set-AzureVMAccessExtension with no parameters fixes any broken RDP settings. After the extension is enabled, to fix RDP settings in future either call the cmdlet again or restart the VM.

  • Disbaling VMAccess:

Read the extension ReferenceName and Version from the output of the following cmdlet:

Get-AzureVM –ServiceName –Name | Get-AzureVMAccessExtension

Get-AzureVM –ServiceName –Name | Set-AzureVMAccessExtension –ReferenceName –Version –Disable | Update-AzureVM

Logoff/Login to the VM to disable VMAccess.

What are the pre-requistes for enabling VM Extensions?

Enabling VM extensions has one simple pre-requisite – create an IaaS VM by enabling the VMAgent. When you create a VM from portal or the latest Azure Powershell , VMAgent is enabled by default unless its manually disabled.

Note : Part 2 of the blog will describe how to enable VMAgent on existing VMs and on VMs created from disks.

What’s next for VM Extensions?

Hopefully the blog so far has given you a peek into how VM Extensions can be used to turn on and turn off additional functionality on the VMs. Bginfo and VMAccess are the first ones out there and we hope to have a few more in the coming months. Stay tuned and hope you’ll come back to this blog to learn more about any new VMExtensions.

 What about Extensions for Cloud Services?

Though this blog is focused on Virtual Machines, I want to add that the Extensions are applicable for Cloud Service VMs as well and a couple of them are already available, RDP and WAD extension for Cloud Services. In upcoming blogs we’ll discuss more these and other new Cloud Services Extensions.