I’m wondering if it is possible to specify the name (or account id) of an Azure subscription as the output variable of a step, such that subsequent steps can use this variable to .
The reason being I want to alternate between a pool of subscriptions that host an application in a test environment; e.g. on even days use Joe’s subscription for deployments to acceptance testing, on odd days use Jane’s subscription for these deployments (additional background: Azure Automation will tear down these environments at the end of the work day, a TeamCity scheduled build will deploy to these environments with Octopus Deploy’s assistance in the morning).
However I get the error message;
The expression #{Octopus.Action[‘Set AzureSubscriptionId’].Output.AzureSubscriptionId} could not be expanded to an Account ID.
where ‘Set AzureSubscriptionId’ is the name of the script step that runs a bit of Powershell to determine which subscription should be used (“it’s an even day, and deploying to Integration Testing, use Jill’s subscription!” “it’s an odd day, and deploying to Acceptance Testing, use Jack’s subscription!”). ‘AzureSubscriptionId’ is the name of the output variable that is set by the ‘Set AzureSubscriptionId’ step.
I was originally using the name of the Azure Subscription but according to…
https://octopus.com/docs/guides/azure-deployments/varying-azure-subscription-by-environment
… it suggests that the Account ID (which is just the Azure subscription name prepended with ‘azureserviceprincipal-’ yes?) should be used.
At any rate, either doesn’t work… so I suspect that Octopus is doing some initial validation of which Azure subscription to use before running any steps, but cannot as the step has not yet run!
Is this correct and this is an unsupported scenario? Or am I doing it wrong?