vendredi 16 septembre 2016

Encrypting username/password files (app.config) and Unit Tests on Visual Studio Teamservices

I have some unit tests which target some overriden app.config files. Each config file has encrypted password/username using DataProtectionConfigurationProvider via aspnet_regiss.exe

This is all fine and dandy on my local machine where they are created. Now when these are deployed and run to our Visual Studio Online Team Services and the buid definition is run, the tests that target the encrypted credentials methods fail because:

System.Configuration.ConfigurationErrorsException: Failed to decrypt using provider 'DataProtectionConfigurationProvider'. Error message from the provider: Key not valid for use in specified state.

I appreciate that this error is caused by not running aspnet_regiis.exe on the local machine the app/tests will be running on.

My question is what is best practice here? Because even if i build a Team Service build definition which runs aspnet_regiis.exe (I presume you can do that) against an unencrypted app.config file first, I'm still storing unencrypted data online for a while.

Aucun commentaire:

Enregistrer un commentaire