Refactoring AA Solution Onboarding to give Linux some love
So some of us are using the free update management and change management solution offered through Azure Automation.
There have been some code in the AA team github repo for some time, though as with all code it degrades over time as dependencies change.
This logic seemed to support onboarding both Windows and Linux, and I did not question this the first time I refactored the code. Though as it turns out Windows and Linux does not follow the same pattern when it comes to what identificator it uses to onboard VMs. The key difference is that for Windows the Id used can be extracted from the ARM api. Namely the VMid property on a VM object. The original assumption was that this was the same for Linux. Though after some investigation it seems that what Linux VMs has for VMid is not the same. The value is instead the internal UUID found inside the OS. This means that to get this, one will need to extract it by interacting with the OS. This is more difficult than for Windows, as this is already taken care of by Azure during VM creation.
Also as we are doing the one stepp to the right routine I added versions both for AzureRM and Az module.
AzureRM Single VM Onboarding:
AzureRM Multi VM Onboarding:
Az Single VM Onboarding:
Az Multi VM Onboarding:
In addition there seems to be no maintenance of onboarded VM’s to the different solutions. Therefor I wrote a runbook that will compare the onboarded VM’s to the VM’s deployed in Azure. If VM’s have been removed from Azure, the Runbook will also remove them from the solutions.
AzureRM Solution query cleanup:
Az Solution query cleanup:
If you need to import the Az modules into AA take a look at: