Monday, 20 May, 2024

How to download and back up Microsoft Azure Web Applications - Part 2

This post explains how to zip and download your Microsoft Azure web application’s files using Azure's KUDU REST API.

This post is part of a series on how to backup Microsoft Azure web applications. Read how to download and backup files using FTPS here. 

Preamble

This post is about Azure KUDU and how to download the contents of folders in your web-app using it's REST API. The article stops short of explaining how to automate the process.

What is KUDU?

Kudu is the engine behind git source control deployments in Microsoft Azure. It also provides a series of tools useful for analysis, debugging and, in our case today, downloading your files.

The KUDU REST API

KUDU provides a REST API which can be used to quickly download web application's files. Full documentation can be found at https://github.com/projectkudu/kudu/wiki/REST-API.

For this post we're only interested in it's Zip functionality.

GET /api/zip/{path}/
Zip up and download the specified folder. 
The zip doesn't include the top folder itself. Make sure you include the trailing slash!

KUDU's Dashboard

To see KUDU's dashboard and all the features it has to offer browse to https://<yourwebapp>.scm.azurewebsites.net.

I'm not going to spend time discussing KUDU's features, it's a useful tool and you should take a look when you have time.

Image of KUDU console dashboard

Note: You'll be asked to authenticate before Azure will allow you to access your KUDU dashboard.

Downloading Zipped Files

KUDU's REST API provides a Zip command which allows us to quickly zip and download files.

Simply type your KUDU URL in to your browser followed by the REST command and the path of the folder you'd like to download. So, for example, to download your web application's file set:

https://???.scm.azurewebsites.net/api/zip//site/wwwroot/

Image of downloading a zip

Note: You'll be asked to authenticate before you'll be allowed to download files.

Conclusion

Azure KUDU is a powerful tool with a many useful features. The KUDU API can help you to discover how your application is configured and diagnose issues; and paired with PowerShell laborious manual tasks, like taking backups or downloading files, can be quickly automated.

Want to Thank Me?

Did you like this article? Was it helpful? Why not buy me a coffee on Paypal? Buy me a coffee?