i built app (ASP .NET Core MVC + Angular). I need to deploy this app for three different customers. Each customer at this moment have its own database. Is it possible to have multiple sites inside one azure web app (like mysite.com/a, mysite.com/b and mysite.com/c) and each of these sites to have its own connection string ? Or should I go with path 1 customer - 1 web app ? Tnx
2 Answers
I'm not sure about having multiple sites as sub-directories.
What you can do is setup 1 Standard App Service Plan and setup multiple App Services within that plan and use subdomains to point to those App Services (CustomerA.mysite.com, CustomerB.mysite.com). There is no additional charge for setting up multiple App Services within a single App Service Plan.
This has a few advantages. You can use Azure's Application Settings Management, you can use deployment slots, and you could update each customer's production environment 1 at a time allowing you to have 1 customer Beta testing while others are running stable code.
While there might be a way to have your application deployed to the same App Service. It would definitely involve editing the Kudu build scripts. I'm don't know much of the details there to get it working.
However, If you stuck with 1 App Service for each customer, you should be able to set up an environment variable in each App Service with a database connection string for each customer. By doing this, you could reference that environment variable in your code so you don't have to recompile with a different database connection string for each customer. To create an enviroment variable in Azure App Service, go to your app in the Azure Portal. Then, select Application Settings from the side bar. Scroll down to App Setting Names, and you should be able to create an application setting with the database connection string for each customer in each App Service.
For more information on how to do that, check out this post on Stack Overflow.
Another option would be to create an App Service with a new slot for each customer. They would all inherit their settings from the master App Service. In each child App Service, you would be able to set an application setting that is slotted, which would only be for that slot. However, this is very similar to the previous option in which you create 3 separate App Services. Here's more information on using slotted App Services. It's intended to be used as a way to create staging and production environments.