I want to preface this with saying that I should have checked to see if a good server backup plan was in place before adjusting a Jenkins job that installs websites to IIS.
In order to help others, can something be done to add some protection around the case that
msdeploy.exe -verb:delete
is inadvertently used with
-dest:apphostconfig=""
?
This situation was caused by a command line statement using a previously set Windows varible which in this set happened to be blank:
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:delete -dest:apphostconfig="%WEB_APP_NAME%",computername=[redacted],username=[redacted],password=[redacted]
The blank variable turned the command into this:
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:delete -dest:apphostconfig="",computername=[redacted],username=[redacted],password=[redacted]
This will completely chew up the entired IIS configuration and all of the web sites. IIS was broke to that point that it would not work without a reinstall of IIS and WAS.
To make matters worse, I had 50+ web apps deleted out and it was 5:40 on a Friday.
After telling my boss (and being lucky enough to keep my job), I began to figure out how to get IIS reinstalled without wiping out the server.
On a Windows 2012 R2 server IIS and WAS had to be force re-installed by PowerShell.
Uninstall-WindowsFeature -Name web-server Uninstall-WindowsFeature -Name WAS-Process-Model
Install-WindowsFeature -Name WAS-Process-Model
Install-WindowsFeature -Name web-server
I now realize that using msdeploy in an automated fashion can be akin to juggling chainsaws.
Is there a way some user feedback or documentation can be added to caution around this situation?