Problem
- We have 3 parameters required to authenticate with our 3rd party service: username, password, securityToken which live in unexpected places (depending on environment they could be in Web.config or CI build scripts).
- We're asking MS Web Deploy to write
<setParameter>values from our XML files but it's ignoring some... specifically the username, password and security token parameters - MS Web Deploy wants to write to
\Views\Web.config. We want to write to\Web.config.
2 Goals
- Organize all of our authentication credentials in to
DeploySettings.xmlfiles respective to each or our environments (dev, qa and production). - Write
<setParameter>values to \Web.config not \Views\Web.config
Details
- We're uisng Jenkins for continuous integration.
- Jenkins is calling MS Web Deploy 3 to handle the deployment.
- We're going to have a DeploySettings file for each environment.
- I'm currently working on our dev environment. For the scope of this question, I'll be referring to our "dev" environment and it's respective
DeploySettings.Dev.xmlfile - The Jenkins deploy script tells web deploy to use
-setParamFileto overwrite \Web.config values with<setParameter>values from theDeploySettings.Dev.xmlfile
Deploy Script calling for DeploySettings file
-setParamFile:"%WORKSPACE%\DeploySettings.Dev.xml" -verbose
DeploySettings.Dev.xml
⚠️ This is not the entire file
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter
name="username"
value="lukeSkywalker" />
<setParameter
name="password"
value="xxxxxx" />
<setParameter
name="token"
value="xxxxxx" />
<setParameter
name="DBConnection"
value="Data Source=fully.qulified.domain;Initial Catalog=CatalogName;uid=obiwan;password=xxxxx;MultipleActiveResultSets=True" />
<setParameter
name="SessionDBConnection"
value="Data Source=1.2.3.4;uid=userId;password=xxxxxx" />
...
Verbose Jenkins Deployment console logging demonstrating that username, password and token are being ignored
note that
username,passwordandtokenare absent
Verbose: Parameter entry 'DBConnection/1' is applicable to '\Web.config' because of its scope.
Verbose: Parameter entry 'SessionDBConnection/1' is applicable to '\Web.config' because of its scope.
Verbose Jenkins Deployment console logging showing that we're writing to the wrong file (\Views\Web.config)
Verbose: Parameter entry 'DBConnection/1' is applicable to '\Views\Web.config' because of its scope.
Verbose: Parameter entry 'DBConnection/1' could not be applied to '\Views\Web.config'. Deployment will continue with the original data. Details:
Verbose: Parameter entry 'DBConnection/1' is applicable to '\Views\Web.config' because of its scope.
Verbose: Parameter entry 'DBConnection/1' could not be applied to '\Views\Web.config'. Deployment will continue with the original data. Details:
Burning Questions
- How do I configure Web Deploy to write to \Web.config? \Views\Web.config is wrong
- How to configure
-setParamFileto fetch and overwriteusername,passwordandtoken?
Thanks for your time.