Creat Project Variable via Powershell

Hi,

Is there any way to create a Project variable with, let’s say, multiple values (one for each environment) via a Powershell step, or any kind of step?

I want to take an output of an ARM template deployment and make it visible in the Octopus UI for everyone in the team,and I was thinking that the Project Variables section might be the only way.

Hi Tudor,

Thanks for getting in touch! You can certainly create project variables based on the values of output variables you create during deployment. This would require some API scripting in your process to define them, and we have an example script that would be a good starting point.

Thinking out of the box, perhaps a better option would be to generate an artifact txt file which would provide a link to download it from the UI. I’ve tested this, and I created an output variable in a script step, deployed a package with the Substitute variables in files feature enabled to target the file to perform variable substitution in, and created the artifact with another script step. The link to download the resulting artifact is shown in the UI like the following.

Would an approach like this help achieve what you’re after? Let me know what you think and if you have any further questions moving forward. :slight_smile:

Best regards,

Kenny

I will try to solve the issue with the script you linked. Thank you very much!

Hi Tudor,

You’re very welcome! Let me know how you go with this approach or if you have any further questions moving forward. :slight_smile:

Best regards,

Kenny

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