Setup TFS Agent to use built in account Network Service as the identity to conduct actions on server. Using Web Deploy to update the web site using a batch file and Web Deploy package with the following syntax:
msdeploy -verb:sync -source:Package=C:\_Agent\LatestDeployments\FarmDemo\LatestPackage\DemoWebFormsApp.zip -dest:Auto -disableLink:AppPoolExtension
2018-04-24T22:09:42.6711726Z 'msdeploy' is not recognized as an internal or external command,
2018-04-24T22:09:42.6711726Z operable program or batch file.
2018-04-24T22:09:42.6711726Z c:\_Agents\Agent_1\_work\r1\a>msdeploy -verb:sync -source:contentPath=C:\_Deployments\OnlineServices\LatestDeploy -dest:contentPath="Default Web Site/OnlineServices"
2018-04-24T22:09:43.6711838Z ##[error]Process completed with exit code 1.
2018-04-24T22:09:43.6711838Z ##[section]Finishing: Run script C:\_Deployments\OnlineServices\OnlineServices_Update.cmd
The path to MSDeploy was set after the build agent was installed and the Path variable was cached with the location of MSDeploy not in the path.
Restart the build agent service and the new path variable is picked up.