I am trying to figure out how to install modules into an Azure automation Account from the PowerShell gallery, and I am struggling…
New-AzAutomationModule should have been able to do this, but it constantly gives a status of “Failed” in the list of modules in Azure Automation. The command I used is this:
$AzMods = Find-Module az.*
ForEach ($AzMod in $AZMods)
{
New-AzAutomationModule -AutomationAccountName $AAccName -Name $AzMod.Name -ContentLinkUri "$($AZMod.RepositorySourceLocation)package/$($AzMod.Name)/$($AzMod.Version)" -ResourceGroupName $RGName -Verbose -ErrorAction Continue
Sleep 5
}
I also tried without the version part of the url, but that didn’t change anything. Does anyone know how to do this successfully? The few posts I have found are sadly out of date and no longer relevant.
I can do it by going to the gallery and click the button to deploy to Azure Automation, so I know that it can be done, but it is hardly optimal to have to do this manually.
It seems that MS has been kicking PowerShell to the kerb for a while now, but it baffles me that installing modules from the gallery isn’t even listed in the Get-Help section