Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy a solution with two projects to Azure App Service?

I am trying to minimize the cost of running my web app in Azure App Service. I have a Visual Studio 2017 solution with two Web Projects: Web and API (both .NET Core). The entire solution is part of a single GitHub Repo. Before adding the API project, the build and deployment to Azure App Service was automated. My goal is to deploy both projects under the same App Service (to minimize cost) with two subdomains (e.g. www.example.com and api.example.com) and keep everything automated.

Is this something that can be done? Can somebody please help me understand how this can be done? Can those settings be commited?

like image 272
Martin Avatar asked Aug 01 '17 21:08

Martin


People also ask

Can we deploy multiple applications in app service?

Yes, the setup is very much possible and is a common requirement. You can deploy multiple separate 'WebApps' under an 'App Service Plan'.

How many deployment slots are available in app Services Azure?

Deployment slots are a feature of Azure App Service Plans. As a result, every App Service resource (Web App, Web API, Mobile App) in Microsoft Azure has the ability to create up to 4 additional deployment slots with the Standard tiers, and up to 20 deployment slots with the Premium tiers.


1 Answers

An Azure App Service Plan can contain multiple web apps. Normally when you use the Azure portal to connect it to source control, Kudu (the tool behind App Service Plans), will create a deployment script for that site.

In case you want to deploy two projects of a single solution (and git repo) to different Web Apps you have to do the following:

  • Create two web apps under the same App Service Plan
  • Connect both of them to the same git repo for automated deployments
  • Modify the deployment parameters

I'm going to suppose you know how to do the first two steps.

To modify the deployment parameters, you could either modify the deployment script by downloading it through Kudu and adapting it or, much simpler, configure it through the portal:

  • Go the App1 => Application Settings => Add setting PROJECT with value <path>\<path-to-app1>.csproj
  • Go the App2 => Application Settings => Add setting PROJECT with value <path>\<path-to-app2>.csproj

Every time you push up a change, both web apps will receive an update, but they will deploy a different part to the web site.

More information can be found here (see last paragraph): https://github.com/projectkudu/kudu/wiki/Customizing-deployments

like image 180
Kenneth Avatar answered Sep 19 '22 16:09

Kenneth