Updating Azure Automation Modules

Azure Automation Module versions are continually changing with Azure.  The inconsistencies caused due to module dependencies is a modern equivalent of DLL Hell and questions the wisdom of creating complex runbooks for use with Azure.

Regardless, the enterprise requirement exists to ensure that multiple Azure Automation servers are using the same versions of modules.  Surprisingly, the Azure console doesn’t provide a method for selecting specific versions of modules for use with the Automation Account.

The update procedure uses PowerShell Gallery.  Substitute the module name and required version of the module into the code snippet to selectively update individual Azure Modules.

$Package = "Azure"
$PackageVersion = "4.4.1"
New-AzureRmAutomationModule -Name $Package `
   -ContentLink "https://www.powershellgallery.com/api/v2/package/$($Package)/$($PackageVersion)/"  `
   -AutomationAccountName "aa-sharedservices-ase" `
   -ResourceGroupName "rg-ase-enterprise-sharedservices"