Using secrets when using run-as

Product: PowerShell Universal
Version: 2.9.3


I am trying to access a secret I have created under Variables in a script under Automation/scripts.
Right now I have a simple script where I am just testing if the variable is available with:
$MY_SECRET -eq $null

Running the script in the environment “Windows Powershell 5.1” works fine (it can see the variable), as long as I just use default credentials. However when I use some other credentials that I have setup, the test tells me that it can’t find the variable.

I just started using PSU today, so I might just be missing some knowledge here, but how can I get access to secrets to work when running with different credentials?

Best Regards,

This is a current limitation of PSU’s secret management. We revamped secrets in v3 (beta out next tuesday) to fix this issue and some performance issues.

In v3, you’ll be able to access secrets from anywhere using the $Secret scope.

1 Like

Hi Adam,
Thank you for the clarification.
The reason I had a “run as” was to be a user that could make a PSSession to another machine. I found out that I could use Authentication in the PSSession, and so I didn’t not need to do the run as, and then I have access to the secrets :slight_smile:
So I got it working for now.

Still it sounds good that it gets improved in the next version :slight_smile:

This feature alone might get me to upgrade to v3.

Accessing secrets while running under different user context is a must for our environment. :slight_smile:

1 Like