How to Check and Update Azure VM Extensions for the Azure Monitor Agent

If you’re working with Azure VM extensions like the Azure Monitor Agent and want to ensure your extensions are up-to-date, here’s a quick guide on verifying the current version and updating to the latest.


Step 1: Check the Current Version of the VM Extension

You can check which version of an extension is installed on your VM using PowerShell. Run the following command, replacing <resourcegroupname>, <vmname>, and <extensionname> with your specifics:

$extension = Get-AzVMExtension -ResourceGroupName <resourcegroupname> -VMName <vmname> -Name <extensionname>
$extension.TypeHandlerVersion

This command outputs the installed version, so you’ll know if an update is available.


Step 2: List Available Versions of the Extension

To see all versions of an extension that are available, run:

Get-AzVMExtensionImage -Location <location> -PublisherName Microsoft.Azure.Monitor -Type AzureMonitorWindowsAgent | Select Version

Replace <location> with the Azure region where your VM is deployed (e.g., EastUS), and this command will list every version available for that extension in your region.


Step 3: Update to the Latest Version

To upgrade your extension to the latest version, use the Set-AzVMExtension command. Specifying -EnableAutomaticUpgrade $true will allow the extension to auto-update when new versions are released:

Set-AzVMExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resourcegroupname> -VMName <vmname> -Location <location> -TypeHandlerVersion <latest_version> -EnableAutomaticUpgrade $true

Replace <latest_version> with the latest available version from Step 2. This will apply the new version to your VM extension, ensuring you have the latest capabilities and security enhancements.


With these steps, you’ll have an easy way to keep your VM extensions up-to-date, allowing you to take advantage of all the latest features and improvements in Azure Monitor Agent and beyond.

Junaid Ahmed
Junaid Ahmed

Junaid Ahmed is a Cloud Infrastructure and Identity Management expert with 10+ years of experience specializing in Azure Entra ID, ADFS, Hybrid Identity, and Azure Infrastructure Management. He has a proven track record of leading secure identity solutions, deploying high-value security projects, and troubleshooting complex Azure issues for global clients. Junaid excels in enhancing system performance, facilitating seamless collaboration across organizations, and delivering expert guidance on cloud migrations and infrastructure optimization. He seeks to leverage his expertise in a challenging Cloud Solution Architect role to drive success through innovative cloud solutions.

Articles: 30

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux