How can I deploy to a Virtual Directory under and Azure website?

Dear Support,

I tried to use “Deploy an Azure Web App” template to publish a package to an App Service’s virtual applications.

I am not sure does latest “Deploy an Azure Web App” template support this feature or not. Where can I config this?

I found this:

But the issue was closed and I am not sure it is fixed or not.

Thanks and hope to hear from you soon.

Regards,
Max

Hi Max,

Thanks for getting in touch. You certain can deploy to a virtual directory, but please do so with caution,
our experience through support has been that deployments to virtual directories in Azure can be quite brittle.

The virtual directories in Azure Web Apps are quite different in a couple of aspects to virtual directories in IIS. The Physical Path field is the key to what you’re after. By default when a package is deployed into a web site it is deployed into the root folder, this field lets you override the folder to chose a descendent folder to deploy to.

I used the word descendent quite deliberately there, and this is a key difference to IIS. A virtual directory in Azure must point to a folder that is somewhere in the directory tree below the site’s root folder. I.e. you’re actually just creating shortcuts within the same folder structure, that run as their own application process.

You therefore have to be very careful with the value of the Remove Additional Files field, if you set that to true then the deployment for each virtual directory can delete the content for all other virtual directories, as can the deployment to the root site. This is a behavior of WebDeploy against Azure Web Apps, it isn’t something Octopus does on purpose or can control.

Does the application architecture require it to be a single site? Other options could be to use 2 sites hosted as appA.company.com and appB.company.com. I haven’t used it personally but I believe Front Door should be able to do reverse proxying to 2 sites too, so you could do something like company.com/appA and company.com/appB. These may not be practical, depending on your needs, but are possibly worth consideration.

Regards
Shannon

Thanks Shannon.

1 Like