How to import modules into Azure Automation Account using PowerShell?

Hi all,

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 constabtly 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?

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