scw
scw

Reputation: 5660

msdeploy error ERROR_USER_UNAUTHORIZED: Web deployment task failed. using IIS7, TFS2010, VS2012

Using Visual Studio 2012, TFS 2010, IIS7

Getting the following errors when I try to build/deploy:

Any CPU | Test
1 error(s), 1 warning(s)

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets      
(4253): Web deployment task failed. (Connected to the remote computer ("server1") using
the Web Management Service, but could not authorize. Make sure that you are using the 
correct user name and password, that the site you are connecting to exists, and that 
the credentials represent a user who has permissions to access the site. Learn more 
at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.)

*snip warning*

Other Errors and Warnings
2 error(s), 0 warning(s)
Building the projects in this solution one at a time. To enable parallel build, please 
add the "/m" switch.
TF270015: 'MSBuild.exe' returned an unexpected exit code. Expected '0'; actual '1'.

I don't have VS2012 on my tfs server, but someone copied their C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0 folder to the tfs server to fix another build issue a while back. I copied the same folder to "server1", did not change the error message.

It still creates the build, just does not deploy.

Upvotes: 15

Views: 19851

Answers (6)

Duck__
Duck__

Reputation: 21

If you end up on this thread and you are having the same error message to deploy to an Azure App Service, make sure that the SCM Basic Auth Publishing Credentials is set to on in the configurations for your web app:

enter image description here

Upvotes: 1

Preston Martin
Preston Martin

Reputation: 2963

I had this same issue in one environment and not in another. My issue was that I did not prepend the computer name to the user name (i.e. p:UserName=testserver\admin vs p:UserName=admin). In my working environment, both servers utilized an account via Active Directory, so this wasn't an issue. Lesson learned!

Upvotes: 2

OutstandingBill
OutstandingBill

Reputation: 2900

This can happen if you specify the wrong site name. You have to enter the name as it appears in the IIS Connections, e.g. Default Web Site.

enter image description here

Upvotes: 3

meverson
meverson

Reputation: 318

We were able to resolve the issue by the following steps:

  • Highlight the website in IIS Manager
  • In the Features view, open up IIS Manager Permissions
  • Verify that the user you are deploying as has been added. If not, click Allow User and add it.

Hope this helps!

Upvotes: 13

I would recommend against using Team Build to do a deployment. I assume that it is doing the compilation for each deployment. This is not a good idea as things can change between builds as compilers are not 100%. You would be better doing a binary deployment with a deployment tool. I have used Release Management for Visual Studio 2013 very effectively to deploy the same binaries from Dev->QA->Prod...

You can get information on how from Professional Application Lifecycle Management with Visual Studio 2013.

Upvotes: -6

scw
scw

Reputation: 5660

I did not have space between my password and the next build argument, so the password was technically wrong.

/p:UserName=scw /p:Password=12345/p:VisualStudioVersion=11.0
/p:UserName=scw /p:Password=12345 /p:VisualStudioVersion=11.0

Upvotes: 9

Related Questions