I\'m trying to deploy a web application from Visual Studio Team Services Build. I\'m using Visual Studio Build task to build the project. Then, use command line task to execute
You cannot deploy locally on a Hosted Agent: you must deploy to another machine. The easiest way is to use VSTS Resource Management and and Agent running on the target machine with administrative privileges (I would suggest to run it non-admin and grant in IIS permission to the user to deploy).