Custom deployment folder on Azure Web Apps with Git

1 minute read | By Prasad K.

Sometimes you don’t want to deploy your application in the default webapps directory when deploying from GitHub (continuous deployment) on Azure webapp. You can do this in 2 ways -

1. Use the SCM_TARGET_PATH to set your path which can be absolute or relative to the D:\home\site path.

   

2. Create two files in your git root:

.deployment

``` {.default .prettyprint .prettyprinted} [config] command=deploy.cmd


### deploy.cmd

``` {.default .prettyprint .prettyprinted}
@echo off 

echo ---Deploying site 
REM ---Deploy the wwwroot folder in repository to default target (wwwroot)
xcopy %DEPLOYMENT_SOURCE%\wwwroot\* %DEPLOYMENT_TARGET%/Y /s 
REM ---Deploy the myapp folder in repository to folder above default target (wwwroot\..\myapp)
xcopy %DEPLOYMENT_SOURCE%\myapp\* %DEPLOYMENT_TARGET%\..\myapp /Y /s 
Commit, push

 

Remember if you are customizing the deployment folder also set the application folder in the Azure portal accordingly, so that Azure recognizes the custom application folder -

 

In case you have a Java webapp and want to change the default context you can refer to my blog - Use Custom Context for Azure Tomcat Application.

Good Luck!!