Web App concepts

Last updated

There are several core concepts involved in deploying Azure Web Apps. Read on for more information.

Packaging Web Apps

In order to deploy Web Apps they must be packaged into an Octopus compatible NuGet package.

Publish your Web App

Publish your Web App with Visual Studio to the file system:

Publish an Azure Web Application

Generate a NuGet package

Octopus requires a Web Apps to be packaged in NuGet package for use by Octopus. The easiest way generate a NuGet package is to use the Octo.exe command line tool:

Packaging a Cloud Service with Octo.exe

Octo.exe pack --id=HelloWeb --basePath=C:\PathToWebApp

Octo.exe will generate a NuGet package containing your Web App:

NuGet Package Explorer

Here is a sample Web App NuGet package: HelloWeb.1.0.0.nupkg

Upload to a NuGet feed

In order to make the NuGet package accessible to Octopus it needs to be uploaded to a package repository. The built-in Octopus package repository is accessible from Library ➜ Packages (click the Show examples link) and is a suitable place to upload your Web App NuGet package:

Package feed

Web App accounts

Deploying a Web App in Octopus requires the configuration of an Azure Account.  Azure Accounts contain the details of Azure subscriptions.

Creating the account

To set up a new Azure account, follow the directions in Creating an Azure Account.

Web App deployment step

Octopus Deploy supports automated deployment of Azure Web Apps (formerly known as Azure Web Sites).

Deployment Step

Add a new 'Deploy an Azure Web App' step to your project. For information about adding a step to the deployment process, see the add step section.

Azure Web App tile

Azure Web App Step

Once an Account is selected, the list of Azure Web Apps available to the subscription associated with the account will populate the 'Web App' select-list.

Physical Path

Allows deployment to a physical sub-directory of the web-root.  This is useful when deploying to Virtual Directories or Web Jobs, and you don't want to deploy the root application at the same time.

Remove additional files

When set, deletes files from the destination that aren't in the source package.

Preserve App_Data

When set, skip Delete operations in the App_Data directory.

Preserve Specific Paths
If you wish to set the "Remove additional files" option but preserve specific paths, see this document.

Enable AppOffline

When set, this safely brings down a website with a blank app_offline.htm file in the root.


Any of the fields above can be switched to use a custom expression.


The following features are available when deploying a package to an Azure Web App.


PowerShell custom scripts executed against an Azure Web App target will have the Azure PowerShell module loaded, and the subscription from the chosen account will be selected.

Preserve Specific Paths When Deploying Azure Web App

When configuring the Deploy an Azure Web App step, if you wish to set the "Remove additional files" option but preserve specific paths (i.e. other than App_Data) you can create a variable named Octopus.Action.Azure.PreservePaths.

The value should be set to a list of regexes, delimeted by ; that will be used to select directories and files to preserve.

For example, to preserve any paths beginning with \Component you could use: