I have a step in my process which runs a PowerShell script.
I need this step to run on the Octopus Server for each tenant in the deployment.
The project requires tenants for the deployment.
I have set up the step with the following settings:
Execution location: Octopus Server on behalf of each deployment target
On behalf of: Selected deployment targets (I have tried with and without this set)
In the script project variables work fine however tenant variables are never populated.
Can you identify what I may have configured incorrectly?
Thanks for getting in touch! I suspect the reason behind the tenant variables never being populated in this way is due to the fact that multi-tenanted deployments creates an individual deployment task per tenant, so not all tenant variables will show as a result.
There might be an approach to get what you’re after; can you expand a bit on your scenario, like what information that’s stored on the tenant variables you’re needing in your script?
In my setup there is currently only a single tenant. There will be more tenants added once I get this working, the particular variable I am trying to access exists in all tenants so in a multi-tenanted deployment I would expect all tasks to be populated with the tenant variable from the tenant for that deployment.
The tenants all have a string variable which contains an Azure Storage Container Name, my PowerShell script needs this info to interact with the correct storage container.