Invoke PowerShell module errors only in Uipath

I have a script which runs fine in PS ISE but within Uipath it errors with this:

Invoke Power Shell: The ‘Connect-AzureAD’ command was found in the module ‘AzureAD’, but the module could not be loaded. For more information, run ‘Import-Module AzureAD’.

The script is supposed to connect to AzureAD. Running the import as suggested does not work either. Any ideas?

UiPath uses the x86 version of PowerShell. Try opening Windows PowerShell (x86) and import the AzureAD module from the shell. Then try running your UiPath workflow again.

You can watch this video about invoking a power shell script in UiPath. It could help you!

Best regards