Deploy Azure Web App or Azure Function from Repository Folder

I participate in a lot of hackathons. Whether its an internal up-skilling event, university hackathon, or on site with a partner. These are often some of the most fun and frustrating things I get to work on.

At just about every hackathon, we use GitHub to setup a central repo with all the parts of the project we are working on. This could for example contain a web app, azure functions, Xamarin app, console app etc. We normally will just throw everything into its own folder and work from the one repo to keep it easy for everyone.

Often, I want to deploy my web app (and only the web app) right from this repo as I am pushing changes to GitHub. Thankfully through Azure, not only is it very easy to setup continuous deployment using GitHub, but you can also specific what folder within the repo to deploy from.

To deploy an ASP.NET Core web app to Azure from a specific folder in your repository, you simply have to add a new application setting called ‘project’ and point it to the source folder of the project.

For example; I have a project consisting of a UWP slideshow application and my web app to manage the slides. The repository can be found here: https://github.com/joescars/MICMediaSlideshow

In this instance, I only want to deploy the folder ‘MicMediaManager’ to my web app. To do this I connected my Azure Web App to GitHub for continuous deployment and then added the following settings to my app settings.

App Settings

That’s it! Now I can update each folder independently and my web app will only publish changes within the source folder specified.

So… what about Azure Functions?

This same method works with Azure Functions as well. I’ve setup a sample repository here: https://github.com/joescars/AzureFunctionsCustomDeployment in which I have a folder with my Functions inside their own sub-folder. I then go to the function app settings, add a project setting and it will deploy all my Functions from that folder.

Azure Function App Settings

Azure Function Custom Project Folder

Happy Coding!