Web Deploy 3.5 added the EncryptWebConfig for encrypting connection strings in Web.config files. While great, the feature only works with connectionStrings and doesn’t support configSource.
To workaround this, we can use the
runCommand provider to invoke “aspnet_regiis.exe” directly:
This leaves us with a problem: non-administrator deploy users don’t have sufficient permission to encrypt configuration sections. And we’re all using non-administrator deploy users, right?
Configuring non-administrator deployments
Assuming non-administrator deployments are already configured, the following changes will allow the user to encrypt configuration sections:
- Create a delegation rule to allow the deploy user to invoke aspnet_regiis.exe
- In IIS Manager, go to “Management service Delegation”
- Create a new, blank rule with the following settings:
- Provider: runCommand
- User: CurrentUser
- RegularExpression: aspnet_regiis.exe
- Grant the deploy user read access to %windir%\system32\inetsrv\config (ignore the errors)
- Add the deploy user to the “Replace a process level token” group policy (Group Policy :: Local Policies :: User Rights Assignment)