Overview

There are a few things we need to ensure Octopus can play nicely with Azure.

Configure Octopus to load Azure Commandlets

We want to be able to use commandlets like Switch-AzureWebsiteSlot in our octopus scripts, but we need to install the commandlets on the server first, and then tell octopus to load them.

Installation Azure Commandlets on VM

  1. Go here and download the Azure cli Windows
  2. Run the installer, and after installed, make sure to "Add" the Microsoft Azure Powershell. Once completed, you will have files in C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1

Configure Octopus Server to load Azure commandlets

Configure Octopus to load the Azure modues. a. Create a file load_azure.ps1

  $octopus = "C:\Program Files\Octopus Deploy\Octopus\Octopus.Server.exe"
  $azurePowerShell = "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1"
  & "$octopus" service --stop
  &"$octopus" configure --azurePowerShellModule "$azurePowerShell"
  & "$octopus" service --start

b. Run that file in a power shell prompt. It will restart Octopus Server and load in the new libraries you just installed on the server.

Configure Octopus variables for Azure deployments.

  • Click "Library"
  • Choose "Variable Set"
  • Click "Add variable set"
    • Name it something like "FL Deployment Variables"
    • Set the variables and their values as defined below.
  • In your Project, under the "Variables" section, choose this variable set and add it to the project.

Remove files that are not in the package.

Octopus.Action.Azure.RemoveAdditionalFiles  = true

Octopus does not by default remove files that are not in your repo / NuGet package. This can cause problems if you delete files in your app, as they would not get deleted on your next deploy.

References



blog comments powered by Disqus

Published

28 September 2015

Category

deployment

Tags