PSU 3.0.0-beta4 Authentication.ps1 Error

Product: PowerShell Universal
Version: 3.0.0-beta4

Error Message received when attempting to authenticate via forms:

2022-04-25 16:08:39.731 -04:00 [ERR] Did not receive authentication result.
The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory.
at <ScriptBlock>, <No file>: line 5
The term 'Get-ADGroupMember' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at <ScriptBlock>, <No file>: line 18

tried this as well in beta1 with same result. attempted to do an explicit import-module at the right scope and still fails to find module to load. works perfectly since 1.x to current 2.10.2.

any others failing to leverage ActiveDirectory module with v3 authentication.ps1?

Are you using the old AD module that isn’t PS7 compatible?
Maybe try the -usewindowspowershell (or something like that) paramater on Import-module.

i did try that in a different way by forcing the security environment to use 5.1 and now i have an error importing the Universal module:

2022-04-26 09:19:49.958 -04:00 [ERR] Did not receive authentication result.
Could not load type 'PowerShellUniversal.IUniversalClient' from assembly 'PowerShellUniversal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at <ScriptBlock>, <No file>: line 5
The 'New-PSUAuthenticationResult' command was found in the module 'Universal', but the module could not be loaded. For more information, run 'Import-Module Universal'.
at <ScriptBlock>, <No file>: line 21

@sgaglione_laz

look at below post i had same issue prior to beta4 and was able to fix it this way

1 Like

@wsl2001 thanks, i’ll try this but i have one other question; are you using integrated or v5.1 or some other version like 7.2?

@sgaglione_laz
by default the authentication portion of PSU relies on integrated PowerShell for this process

when i had the issue with beta2 it was because the fixes from 2.10 didnt make to this version as adam mentioned so the integrated powershell was not loading windows powershell modules.

i currently host PSU in IIS and i use powershell 7.2.2 as my default environment not the integrated but my authentication still use integrated for that portion only.

Thanks for the insight @wsl2001, i managed to revert back to Integrated for the security (was originally like that), and referenced the path to the ActiveDirectory module in the system level ActiveDirectory path.

upon making that change both loading of the 5.1 AD module and the built-in Universal module both loaded and allowed authentication to succeed.

look foward to a future beta that contains the fixes from 2.10 and re-testing.

Thanks again!