microsoft / StigRepo

Automated PowerSTIG Repository for Active Directory environments
38 stars 7 forks source link

Register-AzAutomationNodes with existing DSC extensions #12

Open JakeDean3631 opened 3 years ago

JakeDean3631 commented 3 years ago

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:

  1. 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: image

Azure Automation Node Registration fails in Powershell: image

Registering the VM manually is also not possible as Azure Automation states that the VM is "Connected to another account" image

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.