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 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.
I am moving towards using AAD auth, and i have this working fine for PSU but i think im missing something with dashboards. If i authenticate with PSU through AAD OIDC it then authenticates me with the dashboard. If i then allow this to timeout and go straight to the dashboard i just get forwarded to: https://url/login?returnurl=/ with the PSU logon… any thoughts how i get this to also pass AAD auth into the dashbord directly (im sure im missing a simple step)