Azure Deployment of Mono-Repos in GitHub
Tags: azure, github, devops, monorepo
Published: 2020-04-29 14:40:54

---
title: Azure Deployment of Mono-Repos in GitHub
published: true
date: 2018-02-22 16:16:00 UTC
tags: azure, github, devops, monorepo
canonical_url: https://sebnilsson.com/blog/azure-deployment-of-mono-repos-in-github/
---

With the increasing adoption of [Microservices](https://en.wikipedia.org/wiki/Microservices), one of the [questions](https://www.quora.com/What-companies-use-a-monorepo-but-deploy-as-microservices) sometimes [discussed](https://hackernoon.com/one-vs-many-why-we-moved-from-multiple-git-repos-to-a-monorepo-and-how-we-set-it-up-f4abb0cfe469) is [_mono-repo_ vs. _multi-repo_](http://blog.shippable.com/our-journey-to-microservices-and-a-mono-repository), which tries to answer if you structure your code to have **one large, single repository** for all/multiple microservices or **individual, small repositories** for each microservice.

If you're in the scenario of using a _mono-repo_, where you have multiple projects in a single repo, and you want to **deploy this single code-base to multiple applications and services in Azure** , there is a simple way to do this.

[Kudu](https://github.com/projectkudu/kudu), the engine behind git-deployments in Azure App Service, has [documentation](https://github.com/projectkudu/kudu/wiki) on how to [customize deployments](https://github.com/projectkudu/kudu/wiki/Customizing-deployments), but **only one of these ways works well with the _mono-repo_-scenario**. The approach of using a `.deployment`-file unfortunately locks the configuration of the specified project into your source-code, so **it won't work** for _mono-repos_.

Instead, [using the _Application settings_](https://github.com/projectkudu/kudu/wiki/Customizing-deployments#using-app-settings-instead-of-a-deployment-file) available in all [Azure App Services](https://docs.microsoft.com/en-us/azure/app-service/web-sites-configure), you use the key `PROJECT` to **set the value for the path of the project** you want to be deployed to your different Azure App Services. So this solution works for Function Apps, Web Apps, API Apps and much more.

## Example

If you have the following code-structure in your single repository:

- `/src/ExampleProject/ExampleProject.csproj`
- `/src/ExampleProject.FunctionsApp/ExampleProject.FunctionsApp.csproj`
- `/src/ExampleProject.WebApiApp/ExampleProject.WebApiApp.csproj`
- `/src/ExampleProject.WebApp/ExampleProject.WebApp.csproj`
- `/test/ExampleProject.Tests/ExampleProject.Tests.csproj`

Then you'd set up your `PROJECT`-path in _Application settings_ for your different Application Services like this:

- **Function App** : `"src/ExampleProject.FunctionsApp"`
- **Web App** : `"src/ExampleProject.WebApp"`
- **API App** : `"src/ExampleProject.WebApiApp"`

With the **paths relative to the Git-repository's root-path**. You can also point directly to the `.csproj`-file, if there is any risk of ambiguity in the same file-folder.

When this is done you can [configure your Azure App Services for Continuous Deployment](https://docs.microsoft.com/en-us/azure/app-service/app-service-continuous-deployment) **using the same repository** , in GitHub, Bitbucket, local Git or any other source supported in Azure.