Updating Project Variable


I need to update a project variable dynamically based on a Powershell script in my deployment process. I have a variable called #{SitecoreSiteName} that corresponds to the the IIS site we’re going to deploy to. In our higher environments (QA & Prod), we’re attempting to implement a rendition of blue-green deployments… so two sites in IIS on the same AppPool, but with different site roots. An early step in the deployment process will determine which site is currently running, and should then set #{SitecoreSiteName} equal to the site that’s already off (as that’s the one that’s not live & is safe to deploy to).

I’ve found the output variable syntax of $OctopusParameters[“Octopus.Action[Determine Deployment Site].Output.DeploymentSiteName”], but when I tried placing that value in the project variable for QA… it bugs out. Is this functionality possible?

I’m hoping to not have to write separate steps for the higher environment, but I know that can be one solution… it would just be a lot of copied & pasted code, and not quite an elegant solution.


Hi Brandon,

Thanks for getting in touch! If you set the value of your SitecoreSiteName project variable to have a value of #{Octopus.Action[Determine Deployment Site].Output.DeploymentSiteName}, and that output variable is generated via a script with logic to determine which site is running, I imagine that would be a possible way to approach this.

Could you expand on what you mean by it bugging out? Are you hitting any error message? What’s the resulting behavior?

Another potential option would be to update the project variable value with the output variable similar to the following sample script.

This approach would also require you to update the release’s variable snapshot to apply the change to the project variable on deployments of the same release to subsequent environments.

In case this is helpful, we have a doc page on blue-green deployments in IIS.

And more generally blue-green deployments as a pattern.

I hope this helps get you going. Don’t hesitate to reach out if you have any further questions or concerns. :slight_smile:

Best regards,


Hey Kenny,

Sorry for the delay, I thought I had responded already…

This is great feedback & information. The syntax in your very first paragraph actually seems to have done the trick, but the articles on Blue-Green Deployments will be very helpful.

Thanks again, and I’ll post back if I encounter further issues.


Hi Brandon,

Thanks for following up, and no worries about the delay! That’s great to hear, and thanks for letting me know. Don’t hesitate to reach out if you have any questions or concerns moving forward!

Best regards,


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.