Jul 30 2021 11:11 AM
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.
Thanks
Jul 31 2021 02:03 AM
Aug 10 2021 07:48 AM
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.
Aug 10 2021 10:50 AM
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'
Feb 17 2023 12:46 PM
I had the same issue. To fix this I copied all the module folders from
"C:\Users\<myusername>\Documents\WindowsPowerShell\"
to "C:\Program Files\WindowsPowerShell\Modules\"
After that, everything works fine.