DEV Community

Cover image for How to deploy multiple web apps on the same Azure App Service
Emanuele Bartolesi
Emanuele Bartolesi

Posted on

How to deploy multiple web apps on the same Azure App Service

It is not always necessary to use more than one App Service to publish our applications.
a typical case is when we have a frontend and a backend in two different projects on Visual Studio, but we can publish them to the same app service.

It's very easy. Let's see how we can achieve this goal.

Create a virtual path on the Azure App Service

Navigate on the Azure Portal and click on your app service.
Click on the "Configuration" menu and then on the "Path Mappings" at the top of the page.

Click on the button "New virtual application or directory".
Fill the new form and remember to uncheck the "Directory" checkbox.

virtual path

Deploy from Visual Studio

Azure now is ready to host your two web applications on the same Azure App Service.

From Visual Studio, publish the first web application directly from the wizard.
You don't have to change any settings for this deploy.

Follow the same steps for the second application (in this case the api), but before click on "Publish", click on the link "Show all settings" in the main publish page.

Add "api" in the site name and in the destination url.
Click on "Save" and "Publish".

Publish Settings

Now you have two web applications on the same app service.
Pay attention just to one detail. In this case the settings are shared between the apps and the settings for the application in a virtual directory need to be configured in the main application settings.

Discussion (0)