question

MartinGospodinov-6879 avatar image
0 Votes"
MartinGospodinov-6879 asked MartinGospodinov-5709 answered

Is there a way to delete a stale machine worker from a Hybrid Worker Group in Azure automation account?

Hello. I have inherited the following situation :

Azure Automation account with Hybrid Worker Group and a single Hybrid Worker inside. The machine on which this worker was installed has been decommissioned and doesn't exist anymore. The problem is that it's name is still present in the Hybrid Worker group in Azure. The GUI doesn't provide me with a way to delete just the worker. I can only delete the whole group. Is there a way to delete only that stale worker machine and preserve the group?

azure-automation
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered MartinGospodinov-5709 commented

Maybe this helps:

https://docs.microsoft.com/en-us/azure/automation/automation-windows-hrw-install#remove-windows-hybrid-runbook-worker


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Remove-HybridRunbookWorker cmdlet is part of the HybridRegistration.psd1 module. This module is being installed with the script New-OnPremiseHybridWorker.ps1 during registration of a new machine as a Hybrid worker. When I imported it in a standard powershell console on a non-registered as a worker machine, and tried to run this command, I got this error:

Remove-HybridRunbookWorker : Machine not registered

So the first problem is that in order to be able to delete a worker machine from Azure, we have to have another worker machine.
Since I intended to create a new worker machine anyway, I did just that and tried to delete the stale machine in Azure from the new one. This time Remove-HybridRunbookWorker command with -Verbose switch said that deletion was completed. Yes but no. The old worker machine stays in Azure in it's Hybrid workers group. It's been about fifteen hours so I doubt it's a "waiting" issue.


0 Votes 0 ·
MartinGospodinov-5709 avatar image
0 Votes"
MartinGospodinov-5709 answered AndreasBaumgarten converted comment to answer

Next I intend to put a worker into the group of the stale machine and see if that helps. But I doubt it. Probably this cmdlet Remove-HybridRunbookWorker tries to start the necessary process on the worker machine that is to be deleted and it is this process that tells Azure to delete the machine as well. Since I don't have that machine anymore I'm afraid the only "solution" would be to delete the whole Hybrid worker group.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MartinGospodinov-5709 avatar image
0 Votes"
MartinGospodinov-5709 answered

Well as surprisingly as it sounds, putting the new worker machine into the same hybrid worker group as the stale machine did the trick. Verbose logs in the powershell console were exactly the same, but this time the ghost machine disappeared from the worker group. So to answer my question in the first post:
1. Create a new worker machine in the same hybrid Worker Group as the machine you want to delete. Use the "New-OnPremiseHybridWorker.ps1" script.
2. From the new machine run Remove-HybridRunbookWorker using the "-MachineName" parameter.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.