I store my connection-string in XML file. Then i use it in powershell script. Is there a way to secure it/to encrypt it somehow?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are two methods I’ve seen for encrypting in Powershell
Use *SecureString cmdlets. It should be noted only the Windows ID that encrypted the original string can decrypt it (since it uses the Windows login as key)
Use a pass phrase with the Library-StringCrypto functions
Because of the limitations of the first method, I use the second. I’ll then store my encrypted connection string in a SQL table and lock down permissions. To make a connection I’ll retrieve the connection string from the SQL table and decrypt using a pass phrase.