Deploy a multi-project solution from GitHub with Azure Deployments

Deploy a multi-project solution from GitHub with Azure Deployments

Azure has a simple way to set up a Deployment Option that monitors our GitHub repository and deploys our code when we push commits to a certain branch. Once you’ve given Azure permission to access your GitHub repository, this works out of the box with little fuss in the configuration setup.

This works swimmingly if we only have one web project in our solution, but that's not always the case. A typical example of when we'd have more than one is a project for our website and a project for a separately hosted API, all within the same solution/git repository.

So, what happens when we have multiple web projects in our repository? How can we tell Azure to publish the correct one for a particular web application?

Azure App Settings

Within the Azure Portal, navigate to your web app. Select the Application Settings from the blade and scroll to the App Settings section. Here, you can add the following App Setting, which tells Azure which project it should deploy to this Web App.

Key: PROJECT

Value: [Path to .csproj file]

Then, you can set this PROJECT app setting on any of your other Azure Web Apps to deploy other projects within the same repository.

You can also create .deployment files in the root of your repository to achieve similar behaviour. However, this only allows for one site to be set and requires configuration to be added to source control, so the former is preferable for me.

Now, you can configure each of your Azure Web Apps to deploy a specific project, push your changes to GitHub and have each application deploy the changes automatically. No more messing about having to publish each project individually. Nice and simple.

Further reading https://github.com/projectkudu/kudu/wiki/Customizing-deployments