A new way to deploy your Azure Web Apps and Function Apps
Update! Since this post was written, there’s been some breaking changes to Azure App Services Run-From-Zip feature, this was fixed in Cake.Kudu.Client version 0.6.0 you can read more about that at the post below
This version fixes a breaking change in the Azure App Services Run-From-Zip web app deployment feature.medium.com
A couple of days ago Azure announced that they in preview added a new way to do app services deployments called Run-From-Zip, which lets you deploy using a zip file.
Deploying using a zip file as been possible before, the difference with this new method is that the file isn’t extracted into the “wwwroot” directory, but instead the zip file mounted read only as “wwwroot”.
The zip file can either be hosted externally from the site or in a special folder on the app service itself, and the latter is now what the “Kudu Client” Cake addin now supports — enabling you to use this new method of deployment in your Cake build scripts.
To enable Run-From-Zip deployments you’ll first need to set an application setting called
WEBSITE_USE_ZIP, you either set this to an url when deploying from an external source, or in this case just set it to
Naming things is hard, but the addin now has a method called ZipRunFromDirectory, which will do all the “heavy lifting” and deploy a local directory.
So deploying a site using this new method just becomes a couple of lines of code
The file path returned, is the zip file deployed to the app service.
Behind the curtain
So what does actually happen here?
In a nutshell the method will:
- In memory zip source directory
- Push that zip to
d:\home\data\SitePackagesto a unique date stamped file name
- Push the filename of the zip to
- Via Kudu API call the site to ensure it’s up and right version deployed (a file called
KuduClientZipRunFromDirectoryVersion.txtis included in deployed zip for this purpose)
- Return the remote path of the deployed zip
I’ve tried this for a couple of days now, and have found deployments to be very stable and quick. But really need some more testing to see what the implications of running this in production, how existing apps behave in a read only mode, etc.
This is a shiny new feature still in preview, general guidance and tooling support isn’t quite there yet, but as you seen with this post the primitives are in place to build upon and refine the experience in the future!