AD authentication on Powershell Universal Dashboards

Continuing the discussion from AD authentication example request:

Hi, I’ve tried to get this working on Powershell Universal but doesn’t work. Seems the cmdlets are not available as I cant see them loaded in the log. I want to get the logged in user’s username automatically to be able to display information about their AD account or allow the user the enter different account credentials to authorise displaying that account’s details. How best can I do this?

By default, the authentication is happening within the Universal Server process which means it’s running PS7. If you want to use the AD cmdlets, you can switch to use PowerShell 5.1 by setting the SecurityPowerShellVersion parameter on the Set-PSUSetting cmdlet in %programdata%\UniversalAutomation\.universal\settings.ps1

Thanks but how would I get the currently logged in user’s username for example? How does the dashboard know which user is looking at it? Is there a way it can get the authenticated domain user via the browser somehow?

You can use IIS hosting and Windows Auth to get the current logged in user: https://docs.ironmansoftware.com/config/hosting-iis/hosting-iis-windowsauth

You will will have access to a $User and $Roles variables in your dashboard script. The $User variable will contain a string that is the user name provided by the auth. $Roles will contain an array of the roles that the user is a part of.

Ah cool. I had a feeling that might help but wasn’t sure - I suppose I didn’t really want to go through all that config for IIS :sweat_smile:

Cheers Adam! Btw, bloody great job you’ve done on 1.3 with all the additional features! :+1:t5:

1 Like

We are looking at implementing Windows Auth support without IIS for an upcoming release because setting up IIS can certainly be a pain…

Also, thanks a ton! I’m really excited for this version.

1 Like