Describe the bug
Register-AzAutomationNodes fails if a DSC extension is already applied to target VMs because Azure Automation believes the VM is already being managed.
To Reproduce
Steps to reproduce the behavior:
Run Register-AzAutomationNodes for target machines that have a DSC extension applied
Expected behavior
Systems are successfully registered as Azure Automation Nodes.
Screenshots
Azure VM has a DSC Extension:
Azure Automation Node Registration fails in Powershell:
Registering the VM manually is also not possible as Azure Automation states that the VM is "Connected to another account"
Additional context
Register-AzAutomationNodes function should check for existing DSC extensions and remove them before attempting to register. May need to incorporate a prompt for users and/or a Force switch.
Describe the bug Register-AzAutomationNodes fails if a DSC extension is already applied to target VMs because Azure Automation believes the VM is already being managed.
To Reproduce Steps to reproduce the behavior:
Expected behavior Systems are successfully registered as Azure Automation Nodes.
Screenshots Azure VM has a DSC Extension:![image](https://user-images.githubusercontent.com/35388475/123223822-820bd900-d4d1-11eb-8f09-cf9fd1700886.png)
Azure Automation Node Registration fails in Powershell:![image](https://user-images.githubusercontent.com/35388475/123223899-951ea900-d4d1-11eb-810c-8d17d7a8ad40.png)
Registering the VM manually is also not possible as Azure Automation states that the VM is "Connected to another account"![image](https://user-images.githubusercontent.com/35388475/123224122-c8613800-d4d1-11eb-89e5-19bdb7de3cfb.png)
Additional context Register-AzAutomationNodes function should check for existing DSC extensions and remove them before attempting to register. May need to incorporate a prompt for users and/or a Force switch.