Search code examples
azuretfsbuildvirtual-directoryazure-deploymentazure-web-app-service

How to deploy to a specific Azure virtual directory with Team Foundation Build 2015


In the application settings of an Azure Web App you can configure multiple virtual directories and applications:

Virtual applications and directories

I have a solution with two web application projects. One is a UI and one is a Web API project. I want my continuous integration build in Visual Studio Team Services to be able to deploy the UI to the site root, and the Web API to the webapi virtual directory.

In the old XAML-based build definitions my solution was to use publish profiles. I would then pass MSBuild arguments such that my publish profiles would be used to deploy the two apps (my approach is explained in this question/answer).

These publish profiles still work if I want to publish manually; it's as simple as having one publish profile contain <DeployIisAppPath>mysite</DeployIisAppPath> and the other contain <DeployIisAppPath>mysite/webapi</DeployIisAppPath>.

But using the new 2015 Team Foundation Build deploy steps is proving more difficult. What I have at the moment is this:

Build definition with two deployment steps

This works perfectly except for the webapi deployment. This step fails, complaining that:

The website mysite/webapi was not found. Please specify a valid website name.

Apparently mysite/webapi is not how I specify the virtual directory to deploy to. But I cannot figure out how I'm supposed to specify this in a Azure Web App Deployment step. Does anybody know how to do this?


Solution

  • Microsoft have released a new AzureRM Web App Deployment task that allows for virtual directories.