With the increasing adoption of Microservices, one of the questions sometimes discussed is mono-repo vs. multi-repo, 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, the engine behind git-deployments in Azure App Service, has documentation on how to customize 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 available in all Azure App Services, 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.
If you have the following code-structure in your single repository:
Then you'd set up your
PROJECT-path in Application settings for your different Application Services like this:
- Function App:
- Web App:
- API App:
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 using the same repository, in GitHub, Bitbucket, local Git or any other source supported in Azure.