Failed - installing AzureConnectedMachineAgent

Joseph DiCarlo (JDA PARTNERS TECHNICAL SERVICE) 15 Reputation points Microsoft Vendor
2024-02-21T21:24:49.1133333+00:00

While running the onboardingscript.ps1 while adding a server to Azure ARC for an ODA - received this error: Failed to lock down directory: System.InvalidOperationException: Unable to lock path: C:\ProgramData\AzureConnectedMachineAgent\Log\himds.log with error code: 32. Account running the script is a local admin.

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
337 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Michael Lopez 5 Reputation points
    2024-02-29T12:56:46.4066667+00:00

    This morning I gave it another go to get this working and was successful. I uninstalled the software and reinstalled with success. I am using Windows Server 2022 core. It occurred to me that the agent was installed with wrong or missing values. I first attempted to install the application without the service principal and secret. While I am not 100% this is the reason its my best guess. I searched for the application by

    get-wmiobject -class win32_product | where {$_.name -like "Azure *"}
    
    

    Once confirmed repeat the command wrapped in parentheses

    (get-wmiobject -class win32_product | where {$_.name -like "Azure *"}).uninstall()
    
    1 person found this answer helpful.

  2. Paul Gammon 0 Reputation points
    2024-02-27T17:26:05.29+00:00

    I've hit the same error, did you resolve this at all?

    0 comments No comments

  3. Michael Lopez 5 Reputation points
    2024-02-29T04:48:23.3633333+00:00

    Getting the same error with a multi machine install script. Ran the single machine install on Monday with no issues. Looking at the himds.log file, it shows it is missing a agentconfig.json file. Message repeats about 20 times and then exits. The only real difference between the single machine and multi machine is the service principal id and secret values and flags.

    0 comments No comments

  4. Oleksandr Romaniuk 465 Reputation points
    2024-03-03T12:11:32.98+00:00

    Hello!
    This looks like a bug.

    Try to do it:

    1. Uninstall all extensions in the Azure portal "Azure Arc | Machines" on the required server.
    2. Disconnect the server from Azure Arc: open the server's page in Arc and click on the Delete button OR use the command azcmagent disconnect.
    3. On the server via the command: azcmagent disconnect --force-local-only (to clean up the local state).
    4. Uninstall Azure Connected Machine Agent locally on the server: Control panel => Programs and Features (and after look at the folder C:\Program Files\AzureConnectedMachineAgent, if it is empty, then delete it).
    5. Reboot the server (optional).
    6. Then go to the Azure Arc tab and create the script for onboarding one server.
    7. Run this script from the Administrator and pass the procedure of connecting the server.
    8. Run azcmagent show to check the status of the agent.

    If the above response was helpful, please feel free to "Accept as Answer" and click "Yes" so it can be beneficial to the community.

    0 comments No comments