Deploying Web Apps to Azure App Service using Web Deploy

This guide details how to deploy your web applications to Azure App Service using the Web Deploy (MSDeploy) tool. Web Deploy is a technology that simplifies the migration, configuration, and synchronization of Web applications between IIS servers. Azure App Service leverages this for efficient web app deployments.

Prerequisites

Steps to Deploy using Web Deploy

1. Obtain Deployment Credentials

You need to obtain the Web Deploy credentials for your App Service. These are different from your Azure portal sign-in credentials.

  1. Navigate to your App Service in the Azure portal.
  2. In the left-hand menu, under "Deployment", click on "Deployment Center".
  3. Select the "FTP" or "Local Git" tab (even though we're using Web Deploy, these tabs provide access to the necessary credentials).
  4. Locate the "FTP username" and "FTP password" or "Deployment credentials" section. Copy these values.

2. Configure Your Project for Web Deploy

For .NET applications, Visual Studio simplifies this process. Ensure your project is configured to publish using Web Deploy.

  1. In Visual Studio, right-click on your web application project in Solution Explorer.
  2. Select "Publish...".
  3. Click "New" to set up a new publishing profile.
  4. Choose "App Service" as the target.
  5. Select "Web Deploy" as the publishing method.
  6. Enter the connection string details obtained in Step 1. The server URL will typically be in the format https://.scm.azurewebsites.net.
  7. Enter the username and password obtained in Step 1.
  8. Configure other settings like the site name (your App Service name) and target framework.
  9. Click "Finish" to create the profile.

For non-.NET applications or manual configuration:

You can manually create a Web Deploy package and deploy it using the msdeploy.exe command-line tool.

Example command to create a package:

msdeploy.exe -verb:sync -source:iisApp="MyWebAppName" -dest:package="C:\MyWebAppPackage.zip" -enableRule:AppOffline

Example command to deploy the package:

msdeploy.exe -verb:sync -source:package="C:\MyWebAppPackage.zip" -dest:autoParam=true -dest:iisApp="https://.scm.azurewebsites.net/" - sitiosite=YourSiteName -username: -password:

Note: Replace placeholders with your actual values.

3. Publish Your Application

If using Visual Studio, after configuring the publish profile:

  1. In the Publish window, select the profile you created.
  2. Click "Publish".

Visual Studio will package your application and deploy it to Azure App Service using Web Deploy.

For automated deployments, consider integrating Web Deploy with CI/CD pipelines using Azure DevOps, GitHub Actions, or other tools.

Troubleshooting Common Issues

Azure App Service also supports other deployment methods like Git, FTP, Docker containers, and CI/CD integrations. Explore these options for different workflow needs.

Further Reading