How To Check The Available Extensions For A Virtual Machine Using PowerShell

In this blog, we will discuss how to check the available extensions for the Azure Virtual Machine and also, how to check the installed extension on a Virtual Machine.

What is Virtual Machine Extension?

From MSDN - Azure Virtual Machine extensions are small applications that provide post-deployment configuration and automation tasks on Azure Virtual Machines. Azure VM extensions can be run by using the Azure CLI, PowerShell, Azure Resource Manager templates, and the Azure portal.

If you require an antivirus or docker configuration etc., then we can install these as an extension to our Virtual Machine after creation.

So, we can check all the available extensions to the Virtual Machine using the cmdlet -

Get-AzureVMAvailableExtension | Select ExtensionName, Publisher, CompanyName, Description | Out-gridView

How to check the available extensions for a virtual machine using PowerShell 

Press "Enter".

A window will pop up with available extensions for a virtual machine.

How to check the available extensions for a virtual machine using PowerShell

If you want to check the extension installed at a particular Virtual Machine, then you can write the command with your VM name, like -

$vm=Get-AzureVM-ServiceName"kkazurevm01"-Name"kkazurevm01"
Get-AzureVMExtension-VM$VM|selectExtensionName,Publisher,Version

 How to check the available extensions for a virtual machine using PowerShell

It will tell you what extensions are installed on your VM. From the above image, you can see that in my Virtual Machine extension ‘BGInfo is installed by default.

So, using these few commands, we can get the information about the Virtual Machine extension.