Script RunAs prompt for credentials

I’m looking at moving some auditing scripts into in psu for ease of access, maintainability, and not having to dig through someone’s desktop trying to find them in a year when the next audit comes around.

Since they would need to run under some very privileged accounts, I don’t want to store the credentials in a secret where they could be used for other scripts in psu. Is there a way to have psu prompt for credentials at time of execution to run under that account? Alternatively, is there a way to have role-based access to stored secrets so access to that credential so only users with specific roles can access and use the saved credential?

Product: PowerShell Universal
Version: 3.8.5

Is there a way to have psu prompt for credentials at time of execution to run under that account?

We currently don’t support Get-Credential but it is possible to use Read-Host -AsSecureString to prompt the user for a password.

Alternatively, is there a way to have role-based access to stored secrets so access to that credential so only users with specific roles can access and use the saved credential?

I’ll open an issue for this. We’ve had a few requests for this feature recently.

This is also somewhat related: "Personal" Secret Vaults · Issue #2175 · ironmansoftware/issues · GitHub

1 Like