How to update Variables from Multiple Tenants at once?

Hi All,

I am using the Octopus Client powershell code to update variable sets.
However, the problem is, when I run this project for multiple tenants, all of the tenants are trying to update the variableset at once.

This causes an issue because the first one in wins, and the rest fail because they can’t all update the variable set at once.

Is there a recommended way to have the other tenants detect that a variable set is being updated, and then update the variable set, to ensure that it isn’t ‘dirty’?

Hi @mbrown17305,

Thanks for asking your question, and welcome to the community!

We have a useful script in our documentation that should help you accomplish what you’re after: Update tenant variables - Octopus Deploy

If this script looks appropriate for your use case, you should be able to use it as a starting point and create an array of tenant names, then iterate through them to update the variables.

Note that this script should be tested thoroughly prior to running against any production environment, as it is not guaranteed to work in all scenarios.

I hope you find this helpful, and let us know if you have any further questions.


Thanks for the fast reply. My scenario is a bit different. I have n tenants updating the same variable set(not a project template) at once.

I was wondering if there was some kind of way to detect if a variable set is being updated, and if so wait until it is done and get the latest version on of the variable set to update it.

Hi @mbrown17305,

Thanks for getting back to us and providing us details on your use case.

Sorry to press with questions, but I’m wondering if you could provide me with more details on how your process is currently configured? For example, how many tenants and variable sets are there? Are you using Octopus.Client in a deployment/runbook and these tenants are all editing variables? The more we know about your process and your use case, the better answer we can provide.

Lastly, what is your end goal with this process? This might help us find better suggestions to accomplish your use case.

Looking forward to hearing back from you.

Kind regards,

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