Trigger an Octopus Deploy Runbook using an Elgato Stream deck!

Octopus Deploy Feb 8, 2022

Automation and things that mean a few button clicks less are always a winner (in the right circumstance).  In this blog post I want to share how I am using the Octopus Deploy REST API and my Elgato Stream deck to trigger an Octopus Runbook!

Octopus REST API

Octopus Deploy is built REST API first, meaning everything you see within the Octopus Deploy portal is built on top of that API.

Which again means you can start to perform operations using the REST API.  In this instance I'm going to be using a PowerShell script to query the REST API to publish an Octopus Runbook and then run it.  More on that later. 😉

Elgato Stream deck

If you haven't heard of the Elgato Stream deck, it can be a hardware device or mobile app that allows you be able to perform an action at the press of a button.

Elgato Stream Deck
Elgato Stream Deck

I have mine setup to do things like turn on and off my office lights, which are Phillips Hue and Elgato lights. I've also go buttons that can mute my microphone when in a Zoom call and I have buttons configured to changes scenes within OBS.

There are all sorts of things you can use the buttons for.

Trigger an Octopus Runbook from a script

I wanted a way of being able to keep of a couple of runbooks I have without actually having to log into the Octopus Deploy portal so I had a look a the Octopus Deploy REST API documentation and found a couple of great examples of for doing this.

The first is to publish your Runbook.  

A runbook within Octopus has the status of either draft or published.  A draft is as you'd expect, a work in progress and might not be approved for production use.

A published runbook is one that is approved for use and ready for use.  You need to publish your runbook before you can trigger it through the REST API or the Octopus CLI tool.

So we a published runbook, we now need to run it.

There is also an example of how to do that within the Octopus Documentation.

But that's a separate script and I wanted to have the whole process in one script that could be ran easily....

So I took some of the bits from the run script and pieced it together into one script that now publishes the runbook and then runs it.

You can find my complete PowerShell script here:

This script publishes an Octopus Deploy Runbook and then runs that Runbook
This script publishes an Octopus Deploy Runbook and then runs that Runbook - triggeroctorunbook.ps1

Trigger an Octopus Runbook from my Elgato Stream deck

The thing with scripts though, you can never find them when you want them. So I wanted even quicker way to trick the scripts and runbook.  Then I realised I could actually run that PowerShell script from my Elgato Stream deck!!

Opening the Stream deck software I searched for the System > Open key configuration and dragged it over to a free key.

I gave the key a title that made sense.  In this case "Getting Started Runbook Create".

And then in the App/File section I wrote:

pwsh.exe -executionpolicy bypass -file "C:\triggercreateinfra.ps1"
Elgato Stream deck key configuration
Elgato Stream deck key configuration

Whenever I press that key on my Elgato Stream deck it runs the PowerShell script and kicks off my runbook.  This is a runbook I often have to run before a demo so it's great being able to kick it off easily ahead of the demo. 👍

Let me know what other great things you've done with your Elgato Stream deck!


Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.