Azure Hybrid worker not seeing installed modules

Copper Contributor

Single hybrid worker.  The automation account has the AzureAD module as well as Az.Storage and AzTable installed.  The hybrid worker has the same modules installed, same versions.  From the context of the hybrid worker, the modules work fine.  If I try to execute a runbook against the hybrid worker (saved and published) it says it cannot find AzureAD or AzTable modules. 


If I run Get-Module [AzureAD|AzTable] -List from the test pane nothing happens and it doesnt find the module.  If I run Get-Module Az.Table -List it shows the module.  I am not certain why these modules are not showing up.  I rebooted, waited and still not working.  I havent seen this before.  When using the SharePoint and PnP modules they worked fine.  



4 Replies
Did you install those modules in the Hybrid Worker in an elevated prompt? By default, the hybrid worker job will execute in the Local System context. Therefore, PS modules must be installed system-wide. Can you check if the path C:\Program Files\WindowsPowerShell\Modules contains the required modules?



Hi, thanks for the reply. I remoted into the server and ran GCI on that directory and I see it showing up yes. I also did install with an evelvated prompt. I just dont understand why its not seeing this module. I uninstalled and reinstalled still no luck.





Still no luck, but I found a workaround for now.  Works.


Find-Module AzureADPreview | Save-Module -Path $env:TEMP -Force -Confirm:$false

$modulePath = Join-Path -Path $env:TEMP -ChildPath "AzureADPreview"

Import-Module $modulePath

$cert       = Get-AutomationCertificate -Name 'cert'
$ClientId   = Get-AutomationVariable -Name 'cid'
$TenantID   = Get-AutomationVariable -Name 'tid'

Connect-AzureAD -TenantId $TenantID -ApplicationId $ClientId -CertificateThumbprint $cert.Thumbprint

Get-AzureADUser -SearchString 'jdoe'


I had the same issue.  To fix this I copied all the module folders from
to "C:\Program Files\WindowsPowerShell\Modules\"


After that, everything works fine.