Encrypt connection string post-deployment?

Is is possible to use PowerShell to encrypt a connection string using a post-deployment script? Or some other method?

Thank you!

Hi,

Yes, it is possible to encrypt your Web.Config file with PowerShell. The optimal place to do this would be the Deploy.ps1 for a given package. I’ve also written A Octopus Deploy PowerShell Step Template to do this. You can see how to use it in the article Encrypting connection strings in Web.config on the Octopus Deploy blog.

Hope that helps

Daniel

Great! Thanks for providing a good solution!

Kristine

Hi Daniel,

I’m not able to find your template – this link doesn’t seem to point to it:

http://library.octopusdeploy.com/#!/step-template/actiontemplate-iis-website-encrypt-webconfig-connection-strings

Thanks,
Kristine

Hi Kristine,

The link in the blog was slightly wrong:
https://library.octopusdeploy.com/#!/step-template/actiontemplate-iis-website-encrypt-web.config-connection-strings

Cheers!
Vanessa

Thanks!

Hi Vanessa,

Neither the link in the article nor the one you posted seem to work.

I attached what appears on screen when I try both links.

Is there an updated location for this template?

Rob

Hi Rob,

Please give this one a try https://library.octopusdeploy.com/#!/step-template/actiontemplate-configuration-encrypt-section

Thanks,

Dalmiro