Certificate removed before PostDeploy is executed


I’m deploying to Azure and I’m trying to execute a PostDeploy.ps1 script that will delete the Staging instance from Azure. My PostDeploy script is running, and I’ve copied the loading of Azure PS modules, etc but it fails on loading the management certificate, I assume because the certificate is deleted from the temp folder before the PostDeploy script gets executed. The variables are set though (that point to the Certificate.pfx file).

What would be really good:

  1. Subscription, modules, etc for Azure already loaded when PostDeploy is executed
  2. If not #1 then at least keep the certificate around so I can authorize against Azure and execute my scripts.


Hi - in Octopus 2.0 you can retrieve the Azure certificate as a varaible from $OctopusParameters[“Octopus.Action.Azure.CertificateBytes”] and the thumbprint of it from $OctopusParameters[“Octopus.Action.Azure.CertificateThumbprint”]. There is perhaps a bit of PowerShell involved in loading the cert, but it should be pretty straightforward. Does this help?


Yep, that will help, thanks.