Deploying web packages with MSDEPLOY
<p>I've built my packages and read through this docs @ <a href="http://www.asp.net/web-forms/overview/deployment/web-deployment-in-the-enterprise/deploying-web-packages" rel="nofollow">http://www.asp.net/web-forms/overview/deployment/web-deployment-in-the-enterprise/deploying-web-packages</a></p>

<p>And it seems to suggest that the problem should be relatively simple from here as the instructions clearly show ...</p>

<pre><code>[project name].deploy.cmd [/T | /Y]
                          [/M:&lt;computer name&gt;]
                          [/A:&lt;Basic | NTLM&gt;]
                          [/U:&lt;user name&gt;]
                          [/P:&lt;password&gt;]
                          [/L]
                          [/G:&lt;true | false&gt;]
                          [Additional MSDeploy.exe flags]
</code></pre>

<p>.. so, no problem I thought I will give the command params like this ...</p>

<pre><code>myproj.deploy.cmd /Y /M:test.foo.com /A:basic /U:&lt;my user&gt; /P:&lt;my pass&gt;
</code></pre>

<p>... where the user and pass are an admin account on my server.</p>

<p>For some reason though this results in a 401 ...</p>

<pre><code>Error code: EEROR_USER_NOT_ADMIN
More Information: Connected to 'server' using the Web Deployment Agent Service but could not authorize. Make sure you are an administrator on 'server'
</code></pre>

<p>... well, I used my admin credentials, the same ones I used with VS for the one click deploy and they worked in VS so how come they aren't working on the command line when pushing the package?</p>

<p>...</p>

<p>EDIT: </p>

<p>I looked through the logs, checked out the ms deploy command it was generating and decided to skip the cmd file altogether and go straight to ms deploy myself.</p>

<p>I found the command it was generating and cleaned it up to something like this ...</p>

<pre><code>msdeploy.exe
  -source:package='..\package.zip' 
  -dest:auto,computerName=test.foo.com,userName=&lt;me&gt;,password=&lt;my pass&gt;,authtype=basic,includeAcls=False 
  -verb:sync 
  -disableLink:AppPoolExtension 
  -disableLink:ContentExtension 
  -disableLink:CertificateExtension 
</code></pre>

<p>Apparently my account when used in this context is not an admin (a total lie or perhaps I missed something).</p>

<p>here's what technet has to say on it: <a href="https://technet.microsoft.com/en-gb/library/dd569106(v=ws.10).aspx" rel="nofollow">https://technet.microsoft.com/en-gb/library/dd569106(v=ws.10).aspx</a></p>

<p>which links to this: <a href="https://technet.microsoft.com/en-gb/library/dd569001(v=ws.10).aspx" rel="nofollow">https://technet.microsoft.com/en-gb/library/dd569001(v=ws.10).aspx</a></p>

<p>which states ...</p>

<blockquote>
  <p>The Web Deployment Tool does not perform local impersonation. If you
  provide values for the username and password provider settings but do
  not specify the name of a remote computer for the computerName
  setting, the credentials that you provide will have no effect.</p>
</blockquote>

<p>does this mean because I am specifying a domain name and not a machine name the credentials I am specifying have been ignored?</p>

<p>If so ... how am I supposed to do this?</p>