Introduction
In managing Azure Arc enabled servers, ensuring that your agents are up to date is crucial for maintaining the latest features and security updates. One way to check the latest available version is by referring to the official release notes. However, manually checking this page every time can be a bit cumbersome. In this post, we’ll look at how to automate this task using PowerShell.
Scripting the Version Check
My goal is to retrieve the latest version of the Azure Connected Machine agent listed on the official release notes page and store it in a variable for further use. Here’s how we can achieve this:
# What's new with Azure Connected Machine agent URL
$url = "https://learn.microsoft.com/en-us/azure/azure-arc/servers/agent-release-notes"
$PageContent = (Invoke-WebRequest -Uri $url).Content
$VersionInfo = [regex]::Matches($PageContent, 'Version (\d+\.\d+) - ([A-Za-z]+ \d+)')
$LatestArcVersionFromWeb = $VersionInfo[0].Groups[1].Value
$LatestArcVersionFromWeb
Now you can take the script and put it on Azure Automation to run it daily. If there is a new version of the agent, it will post that information to a Microsoft Teams channel using the incoming webhook.
Explore More
Delve deeper into managing your Azure Arc-enabled servers with an enhanced script in our latest post. Now, not only retrieve the latest agent version but compare it with your deployed agents and generate a comprehensive report. Check out the post here for a more detailed approach.