FIX: HybridWorker Machine is already registered to different account

HybridWorker’s in Azure Automation the basics.

From one Azure Automation tenant, we push maintenance scripts that run at different customers at the same amount of time.

At my work, we changed our managed Services department to a different operations management suite (OMS) in order to better divide our network from that of our customers.

I had the task of converting the Hybrid Workers from customers to the new OMS.

I ran this in an Elevated PowerShell prompt:

Remove-HybridRunbookWorker -url "URL" -key "KEY"

You’d think that this would remove the old Hybrid Worker. unfortunately, I received an error message after I tried to add the hybrid worker again.

Add-HybridRunbookWorker –Url "URL" -Key "KEY" -GroupName "GROUPNAME" 

Add-HybridRunbookWorker : {"Message":"Machine is already registered to a different account. "}

Because I couldn’t remove the Hybrid Worker I started Googling and I came across the registerkeys. I then decided to completely remove these.


Lets fix “HybridWorker Machine is already registered to different account”.

  1. Click start and search for Run, or press CTRL + R.
  2. Type in REGEDIT and click OK.
  3. Search for:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HybridRunbookWorker
  4. Delete the complete registry key.

Now you can run the following cmdlet again:

Add-HybridRunbookWorker –Url "URL" -Key "KEY" -GroupName "GROUPNAME"

it successfully configured the Hybrid Worker.


Re-configure the Operations Management Suite.

If you stumbled on this post and you have also changed the operations management suite (OMS), do not forget to also change the OMS monitoring agent Workspace. Otherwise your HybridWorker will still heartbeat to the old OMS workspace.

  1. Go to start and look for Control Panel or right mouse click on start and click on Control Panel.
  2. Open System and Security.
  3. Open Microsoft Monitoring Agent.
  4. Go to tab Azure Log Analyctics (OMS).
  5. Click Add…
  6. Enter the correct OMS data and click OK.
  7. Click OK again.
Machine is already registered to different account
Machine is already registered to different account

Recap

If you want to know what a HybridWorker is, or what you can do with it. There is a blog post on technet with a great explanation and how to use it: Microsoft.

We mainly use it for a self service portal and our maintenance tasks.

Do you have any feedback or comments? Please leave a comment.

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work as a PowerShell DevOps Engineer. In my spare time I write about interesting stuff that I encounter during my work.

4 thoughts on “FIX: HybridWorker Machine is already registered to different account”

Leave a Reply

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