Is there an unintended bug in the azcmagent_check_updates.ps1 script?

Daniel Campbell 0 Reputation points
2026-07-20T19:04:04.8166667+00:00

I have identified a possible bug in the azcmagent_check_updates.ps1 script for the Azure Connected Machine Agent. This script is used via a scheduled task to update the agent. I understand the feature is in Preview. If anyone from the technical side from MS reads this, please forward to the Arc dev team.

Bug: Azure Connected Machine Agent update script exits after partnerconfig get serialNumber --partner hcrp throws, instead of continuing to initialize hcrp registration.

Expected behavior: If serialNumber is not already set, the script should catch that case and proceed to set serialNumber and machineprofile.

Actual behavior: The first get serialNumber call throws, the script does not recover, and the scheduled task remains stuck in Running state.

This is happening in the latest version of the script. As of this posting: 1.66.03466.3076

Azure Arc
Azure Arc

A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.


2 answers

Sort by: Most helpful
  1. Lakshma Reddy Vattijonnala 1,335 Reputation points Microsoft External Staff Moderator
    2026-07-21T12:26:19.3666667+00:00

    Hi @Daniel Campbell

    You are right that this is a script-side gap, not a config issue on your end. The azcmagent partnerconfig command is officially marked as"Reserved for internal use" in the azcmagent CLI reference, so it isn't something you are expected to work around from outside the script. The azcmagent_check_updates.ps1 script that runs under the azcmagent scheduled task is the one that must handle the "serialNumber not yet set" condition and fall through to initialize hcrp. As you noted, it currently exits on the first thrown exception instead, which is why the task stays stuck in Running.

    This path is part of the Automatic Agent Upgrade (Preview) feature. Automatic Agent Upgrade is still in Public Preview and the product group is actively iterating on the launcher/check scripts for example, 1.64 already shipped a related fix ("removed false positives from the upgrade launcher script") per the What's new with Azure Connected Machine agent release notes.

    Interim workaround while a fix is released:

    • End the hung scheduled task: Stop-ScheduledTask -TaskName azcmagent and confirm the state returns to Ready.
    • Temporarily disable Automatic Agent Upgrade on the affected machine by setting agentUpgrade.enableAutomaticUpgrade to false via ARM (see Manage Azure Connected Machine agent versions).
    • Upgrade the agent manually until the script fix ships — either through Microsoft Update, the MSI, or the azcmagent upgrade command (supported on 1.62+).

    Please keep an eye on the release notes — the fix will be called out there once it lands. If this response addressed your question

    If you have further questions regarding this answer, feel free to click "Comment". If you find the answer helpful, please click "upvote" and accept it. This helps the community by allowing others with similar queries to easily find the solution.

    Was this answer helpful?

    0 comments No comments

  2. Michele Ariis 7,315 Reputation points MVP Volunteer Moderator
    2026-07-21T08:34:42.69+00:00

    Hi Daniel; based on the behavior you described, this does look like an unintended error-handling issue in the script; if the purpose of the first partnerconfig get serialNumber --partner hcrp call is to check whether the value already exists, a missing value should be treated as an expected condition and the script should continue with the initialization of serialNumber and machineprofile

    The fact that the scheduled task remains in the Running state also suggests that the exception is not being handled correctly or that a child process is left open after the failure.

    Automatic upgrades are currently still in preview, so I would definitely open a support case or report it through the Azure Arc feedback channel and include the script version, the complete PowerShell error, the scheduled task history and the Connected Machine Agent logs; Microsoft documents the automatic upgrade feature as preview and recommends checking the agent logs when troubleshooting agent failures.

    As a temporary workaround, wrapping the initial partnerconfig get call in a dedicated try/catch, or checking its exit code without terminating the script, should allow the registration logic to continue when the value is not yet configured; I would still avoid permanently modifying the Microsoft script without keeping a copy, since it may be replaced during the next agent update.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.