Publishing downloading webapp from Microsoft Azure using Kudu Api

Nowadays, everyone like to move their data into cloud since its high availability from anywhere in the world and more secure. When the demand for the cloud computing increases, the technology/features given by the cloud computing service also becoming more and stable. One of the leading cloud computing service provider is Microsoft with their service Azure where we can have SaaS, PaaS, IaaS. Most of the websites are hosted as webapps in Azure and we’ll see how we can publishing downloading webapp from Microsoft Azure using Kudu Api.

For those who don’t know about Kudu, Kudu is the engine behind git deployments in Azure Web Sites. It can also run outside of Azure. Its Api provide an easy way to manipulate the Azure webapp files. Here I have written some code block using C# to download the webapp from Azure and deploy/publish the site to Azure. Whenever we access the Kudu REST api, we need to pass the kuduApiAuthorisationToken with the request.

First we’ll create the kuduApiAuthorisationToken. In order to create the token we need to get the Git username and password of PublishingProfile. Since this PublishingProfile may vary webapp to webapp, we have to take it from Azure by passing the webapp name.

So first we’ll login to Azure using C#

Note: you need to install Nuget packages to get the following packages. Microsoft.Azure.Management.Fluent; Microsoft.Azure.Management.ResourceManager.Fluent;

Also, you can refer the following url to find out the clientId, clientSecret and tenantId values in Azure portal.

Now, we’ll create the token for Kudu Api.

Please not that the Kudu Api token has its own format and we need to construct according to that. We can find the subscriptionId and resourceGroupName of the webapp easily in the azure portal.


Finally we ready to deploy the files. Please not that the deployment files should be zipped. The kudu api(zipdeploy) will take care of those files and put it to the folder.


Download the webapp


Also Kudu Api allows to delete the files by mentioning the correct path.


you can find more Kudu Api methods here and adjust the methods using the correct urls.

Happy Clouding 🙂

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: