Lahiru Kurukulasuriya

Automated Deployment of Azure Web Apps using the Octopus Deploy tool – A Step-by-Step Guide

Octopus Deploy is an automated deployment server, which anyone can personally install. Its installation is similar to that of SQL Server, Team Foundation Server or JetBrains TeamCity.

At Mitra Innovation, we like to share our knowledge and experience and thought it would be helpful to explain what Octopus Deploy is and provide a guide for its use in the deployment of Azure Web Apps.

Octopus Deploy is an automated deployment server, which anyone can personally install. Its installation is similar to that of SQL Server, Team Foundation Server or JetBrains TeamCity. Octopus makes it easy to automate deployment of ASP.NET web applications and Windows Services into development, test and production environments.

At Mitra Innovation, we like to share our knowledge and experience and thought it would be helpful to explain what Octopus Deploy is and provide a guide for its use in the deployment of Azure Web Apps.

Automated Deployment

A newly created application may work fine on your computer, but that doesn’t mean it is really ready for others to use. Web application must live somewhere other than one’s own desktop or laptop. Deployment makes applications available for use by packaging them up and putting them in production environments that can run the applications. Automated Deployment is an approach to deployment that enables the deployment of applications across the various environments used in the development process, as well as the final production environments. The result is more efficient, reliable, and predictable deployments.

Solutions that automate the deployment processes improve the productivity of both the Dev and Ops teams and enable them and the business to develop faster, accomplish more, and ultimately build better software that is deployed more frequently and functions more reliably for the end-user. The Automated deployment process requires a checklist to be executed which may differ based on application type. The Deployment steps may also differ depending on the server type.

There are various approaches for automating the deployment of applications –Scripting, Continuous Integration, Basic Deployment Tools, Model Driven Deployment, and Continuous Deployment – and it is essential that the differences between them are understood in order to choose the most appropriate one that meets the needs to be fulfilled.

Octopus Deploy and Azure Web Apps

The management of deployments across multiple environments can be a complex and challenging process but Octopus Deploy succeeds in making the deployment process simpler, faster and provides more options and functional capabilities. This automated software deployment tool and release management server is specifically designed to simplify deployment of ASP.NET applications, Windows Services and databases. Over the last four years, it has quickly become one of the most popular .NET deployment servers.

Octopus takes over where the Build/Continuous Integration (CI) server finishes. The build server builds the code and runs tests, while Octopus takes care of deployment. Octopus has deep integration with JetBrains TeamCity and Microsoft Team Foundation Server, and has a command line application for creating and deploying releases that can be integrated with any build server.

Octopus also comes with a comprehensive REST API and a .NET client library; anything that can be done through the UI can be done through the API. Octopus Deploy is used to deploy applications securely to servers that are on-premises or in the cloud. It has a web-based interface, which can be used to modify and execute deployments, and a dashboard that teams can use to view the status of deployments.

Azure Web Apps are the compute resources for hosting a website or web application. These compute resources can be on shared or dedicated virtual machines (VMs), depending on the pricing tier chosen. The application code runs in a managed VM that is isolated from other customers. The code can be in any language or framework that is supported by Azure App Service, such as ASP.NET, Node.js, Java, PHP, or Python. Scripts that use PowerShell and other scripting languages can also be run in a web app.

Azure Web Apps enable developers to easily deploy and scale enterprise grade web applications written in a variety of languages and integrated with a multitude of services without ever worrying about infrastructure management.

The Azure Web Apps built, and how one might want to deploy them, are becoming increasingly complex as the Azure team provides more features to the platform. Octopus deploy has special support for Windows Azure cloud services, Windows Azure web apps and web jobs, and deploying to Linux servers via SSH. Let’s look at how Octopus Deploy helps with the deployment of Azure web apps.

Deployment of Azure Web Apps with Octopus Deploy
To begin with the following are required:
● Visual Studio 2015
● An Azure Subscription
● An Octopus Account

Furthermore, the latest Octopus Server and Tentacles (a lightweight agent service) should be installed in your server. The links below can be followed to setup the server environment.


Octopus installation guide


Octopus Key Concepts

Step 1 –Solution Configurations:
Whenever you want to deploy applications with Octopus, you’ll need to package them into NuGet packages. Install OctopackNuget package to your WebApp project.

Step 2 –Octopus Configurations (Screenshots):


A. Next, you’ll need to add environments to deploy to. Environments are really just groups of machines that you deploy to; for example, Test, Staging or Production. Click “Add deployment target” to the deployment target.

B. Now choose the Web App type you wish to use:

C. Then configure your settings accordingly:

Note: Within the ‘Roles’ field you can map the Deployment Target with the Deployment Process.

D.Then select your project from the ‘Projects’ dropdown and click on the ‘Process’ tab. (‘Projects’ define a set of deployment steps that you want Octopus Deploy to perform, as well as the configuration variables.)

E. Finally, add a new process step to deploy your web app.

Now you can start a new release and check if the configured Azure Web App is deploying to the cloud via Octopus Deploy.

Once you have properly configured your project, you’ll be able to deploy your projects to any environment with a few clicks.


The benefits of Octopus Deploy


Using the Octopus Deploy tool is highly advantageous among other .Net Deployment tools. Here’s why:

● It distributes and deploys applications to all remote machines
● The connection is secured using public/private key cryptography
● It can keep environment-specific configuration
● It configures IIS sites and installs Windows Services
● It can work across many machines in parallel
● It supports all .NET applications including open source frameworks like NServiceBus and MassTransit, Nancy, and TopShelf
● It can configure the approval process for the deployment
● It sends acknowledgement emails after successful deployments
● It is easy to revert back to a previous version in a failure




Automated deployment as a process has become increasingly important for organisations that seek to improve their ability to deliver high-quality, valuable software applications in an efficient, fast, and reliable manner. Octopus Deploy’s support for automated deployment of Azure Web Apps makes it a good tool to use when working with the latter. Furthermore Octopus Deploy is designed to fit into teams that follow Agile delivery practices. Finally, due to its ease of use, Octopus Deploy can help reduce the time it takes to set up an automated deployment process, to just an hour or two. This provides a one-click, fully hands-off totally automate deployment process.

We hope you’ve found this technical guide useful. Good luck with your deployments!

Lahiru Kurukulasuriya

Software Engineer | Mitra Innovation

Lahiru Kurukulasuriya is a Software Engineer at Mitra Innovation, a technology company that specialises in product and company incubation, systems integration, and digital transformation and innovation.

Find out how Lahiru and the rest of the Mitra team can help you make the most of Octopus Deploy for automated deployment.