Skip to content

MSDeploy VS. ZipDeploy

Suwat Ch edited this page Jun 27, 2023 · 17 revisions

Overview

These are two common ways to deploy your application given zipped artifact; MSDeploy and ZipDeploy. These are two different mechanisms and their package layout are different and not interchangeable.

MSDeploy

MSDeploy, only applicable to Windows-based application, has been there since IIS and it has many options not only to simply unzip and lay out the artifacts; but also configure various IIS and web configurations. One requires VS or MSDeploy tooling to generate MSDeploy zip package (not typical Windows nor Powershell to create zip file from folder). If you are using other tooling such as typical zip tool, the MSDeploy may not understand the content resulting in unintelligible error such as certain directory not found or create file operation failed. The content in the zip is usually not the same as the outcome on d:\home\site\wwwroot.

ZipDeploy

ZipDeploy (as name stated) is intended for xcopy or ftp style deployment. It unzips the artifacts and lay them out exactly to d:\home\site\wwwroot. You can use any tooling (such as one coming with Windows) to zip your content.

By default, the Zip package will be deflated to d:\home\site\wwwroot as is. Optionally, to allow Zip package deployed with ZipDeploy to mount as read-only virtual filesystem directly without deflating or extracting, do set appSettings WEBSITE_RUN_FROM_PACKAGE=1. This setting does **not** work with MSDeploy. The advantage is to allow atomic and reliable deployment (no more files being locked). Since it will mount as read-only, app runtime will not be able to create or modify files under d:\home\site\wwwroot. In addition, Azure Functions Portal will also prevent you from modifying the Function Apps.

ARM Template support

Both deployments supported by ARM template (just different extension name) – samples below.

        {
          "name": "[concat(parameters('siteName'), '/MSDeploy')]",
          "type": "Microsoft.Web/sites/extensions",
          "apiVersion": "2015-08-01",
          "properties": {
            "packageUri": "https://..../msdeploy_content.zip"
          }
        }
        {
          "name": "[concat(parameters('siteName'), '/ZipDeploy')]",
          "type": "Microsoft.Web/sites/extensions",
          "apiVersion": "2015-08-01",
          "properties": {
            "packageUri": "https://..../zipdeploy_content.zip"
          }
        }

Note: ARM does not support stream content; meaning, one cannot upload local content directly to WebApp via ARM. Instead, the content needs to be out-of-band upload to a service (such as Azure Storage) which subsequently allows access to http(s). Then, configure the packageUri with the content URL with ARM template.

SCM REST APIs

To deploy directly to SCM, call PUT with below payload

        PUT /msdeploy
        {
          "packageUri": "https://..../msdeploy_content.zip"
        }
        PUT /api/zipdeploy
        {
          "packageUri": "https://..../zipdeploy_content.zip"
        }

Note: For MSDeploy, the deployment will happen in the background and status can be polled from /msdeploy/status. For ZipDeploy, see this.

Clone this wiki locally