Reputation: 1441
I have an Azure Web App, and have added the publish profile into Visual Studio. When I run a Web Deploy, it works. All I want to do is that exact same deployment, but from the command line. Here is the command I'm using:
msdeploy.exe
-verb:sync
-source:dirpath="path\to\files"
-dest:dirpath="c:\home\site\wwwroot",ComputerName="https://myappservice.scm.azurewebsites.net",UserName="user",Password="pass",AuthType="Basic"
This is giving me a 401 with the error message ERROR_USER_NOT_ADMIN
.
I've tried the application scope credentials, which are the same ones defined in the publish profile that Visual Studio is using to perform a successful deployment, so I don't understand why they don't work when I use them in the command line.
I've also tried the user scope credentials, which work when I perform an FTP deployment from the command line, and in Azure it says these can be used for Web Deploy, so again I don't understand why these aren't accepted.
I've also tried my Azure admin login, and this one really confuses me, because if I log out of Azure, then go to the same SCM URL as in my command, I am prompted to login. I provide these credentials, and it lets me in. This is definitely an admin account, so again I don't understand why msdeploy
considers them to be non-admin credentials.
Also, worth noting that the above only works in the Developer PowerShell
window. If I open cmd
outside of the project scope, then I just get ERROR_DESTINATION_NOT_REACHABLE
.
Most other questions I've seen are server-side issues (not installing dependencies, etc.), but since Visual Studio is able to run the deployment, I'm sure the issue is not on that side. Can someone please just tell me what stupid thing I'm doing!
Upvotes: 0
Views: 66
Reputation: 3448
If I open
cmd
outside of the project scope, then I just getERROR_DESTINATION_NOT_REACHABLE
.
The ERROR_DESTINATION_NOT_REACHABLE
error indicates an issue with connecting to the destination URL, possibly due to SSL certificate validation or network issues. Adding -allowUntrusted
to the command tells msdeploy
to ignore SSL certificate warnings.
include -allowUntrusted
as an additional parameter in your msdeploy
command
This flag allows msdeploy
to proceed without validating the SSL certificate of the destination.
Use the credentials from the publish profile you download from Azure webapp
Go to Web App in the Azure Portal you can find Download public profile click on it.
Open the downloaded file extract the UserName
and Password
from the publish profile XML.
Use:
msdeploy.exe -verb:sync -source:dirPath="path\to\files" -dest:contentPath="site\wwwroot",ComputerName="https://myappservice.scm.azurewebsites.net:443/msdeploy.axd",UserName="$MyApp",Password="password",AuthType="Basic" -verbose
$MyApp
Test the credentials:
Deployment status in cmd line:
Verifying the destination...
Using URL: https://dotnetwebapp01-dfghbggjh4dra9gs.scm.azurewebsites.net/msdeploy.axd
Verifying source path...
Source: C:\path\to\your\app
Destination: site\wwwroot on https://dotnetwebapp01-dfghbggjh4dra9gs.scm.azurewebsites.net/msdeploy.axd
Using authentication type: Basic
Connecting to destination server...
Establishing connection to server...
Authentication successful.
Preparing for file synchronization...
Synchronizing the following directories:
Source: C:\path\to\your\app
Destination: site\wwwroot
File synchronization successful:
Copied 200 files (10MB)
Total time: 2.34 seconds
Operation completed successfully.
Deployment finished: https://dotnetwebapp01-dfghbggjh4dra9gs.scm.azurewebsites.net/msdeploy.axd
Upvotes: 0