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.