How to get a database backup and encrypt your Master Key

When you contact Octopus Deploy support, sometimes we aren’t able to reproduce the issue you’re experiencing. This can be due to specific circumstances in your instance, or corrupted data which we won’t be able to reproduce. We may ask you to send us a database backup and your encrypted Master Key, which will allow us to accurately reproduce the issue and aid in resolving it. This guide provides a walk-through to get the best information for us to help troubleshoot the issues.

  1. Create the database backup.

The easiest way to import a database is to restore from a .bak file, and this is the format we will ask for. This can be produced from SQL Server Management Studio. Right-click on the Octopus database, and select Tasks ➜ Back Up…, and select the directory where the .bak file will save to.

Backup SQL database in SQL Server Management Studio

  1. Encrypt your Master Key.

You can get your Master Key using Octopus Manager or by using the show-master-key command in Octopus.Server.exe.

We have a PowerShell snippet which will encrypt your Master Key, using Public Key Cryptography so only Octopus can decrypt it. You can use this snippet to encrypt your Master Key, and when we receive it, we will decrypt it and use it to restore the database you have provided to us.


function Encrypt-ForOctopusEyesOnly($secretMessage) {
    $certBytes = [System.Convert]::FromBase64String($octopusPublicKey)
    $x = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @(,$certBytes)
    $publicKey = $x.PublicKey.Key;
    $plainBytes = [System.Text.Encoding]::UTF8.GetBytes($secretMessage)
    $encryptedBytes = $publicKey.Encrypt($plainBytes, $false);
    $encryptedText = [System.Convert]::ToBase64String($encryptedBytes)
    return $encryptedText

$message = Encrypt-ForOctopusEyesOnly "YourMasterKey"
write-host $message
  1. Upload your database backup and encrypted Master Key.

In your email or forum thread with Octopus support, we will provide you with a secure and private link to upload your database backup and the encrypted Master Key. Only we have access to view and download these files, and we will only allow upload access to you. We will also ensure your forum thread is marked as private if it hasn’t already been, to ensure only you and our team can see the link.

Help us continuously improve

Please let us know if you have any feedback about this page.

Send feedback

Page updated on Sunday, January 1, 2023