I know there is a way to store a credential securely, but I don’t recall how to do it.
Edit: I found How to Encrypt Passwords in PowerShell (altaro.com) I might have to depend on this method which will work if I decrypt the password to send along with the connection string.
I also don’t know if it will work for an Oracle db credential. More specifically, how I’d use the stored credential to make the connection.
I’d appreciate some direction on these.
I have to mention that I don’t have any experience with Oracle dbs at all. And recommendations heavily depend on the actual task you want to get done.
IMHO the easiest way to deal with credentials is to use the task scheduler and its ability to run tasks impersonating an account of your choice. This way you don’t have actually deal with credentials in your script at all.
If that’s not feasable you can use the way you’ve found online. You should just keep in mind that this technique only works on the machine you used to save the encrypted password with the account you used to encrypt the password. You cannot transfer it to another machine and run it there. You would need to encrypt and save it there again.
Another way might be to use the secrets management module
Thanks Olaf, you’ve confirmed what I thought.