0

I have an IIS server with MSdeploy installed in order to deploy my site. I'd like to deploy my site in a pipeline on gitlab and so I run the command :

msdeploy -verb:sync -source:package=“\publish\mysite.zip” -dest:auto,computerName=myiisserver,username=admin,password=password,authType=NTLM
msdeploy -verb:sync -source:package=“\publish\mysite.zip” -dest:auto,computerName=myiisserver,username=admin,password=password,authType=Basic

But it gives me an unauthorized 401 error. I've put my admin account under the administrator group, and I've also authorized my admin account on my iis site.

Error Code: ERROR_USER_NOT_ADMIN
More Information: Connected to 'myiisserver' using the Web Deployment Agent Service, 
but could not authorize. Make sure you are an administrator on 'myiisserver'.  Learn 
more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_ADMIN.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
 

What's more, I've managed to use Web Deploy from Visual Studio with the same admin account and it deploys perfectly.

Do you have any idea how to solve the problem?

IIS Version : 10.0.0 Web Deploy Version : 4.0.0

1 Answer 1

0

You could follow this offical document Web Deploy error codes

  • Create a separate user group MSDepSvcUsers on remote computer.
  • Create a local account A on both local and remote computer.
  • Add A to MSDepSvcUsers on remote computer.
  • Use account A to publish, this allows you to publish without the need of a built-in admin account.

Make sure management service is remote connection is enabled and set to allow windows and iis credentials

Sign up to request clarification or add additional context in comments.

3 Comments

I have a domain setup so it seems to not work. My user is set as administrator group and i allow permission on my IIS Management Service + WebDeploy i give the right to deploy with this user and it still say that i'm not allow because i'm not admin. But i can deploy with this account on VS 2022
@Dae could you try with the iis user. i mean open iis and in middle pane you can see the iis manager user there create new user and try with that user
Oh well i didn't try with the IIS User but your first answer was the first step of the resolution. I create the group and add my old user to that group and it work now. I can't explain how but now that work... thank you Jalpa !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.