Prompt for Azure Account variable in runbook

I have a project variable of type Azure Account scoped to a runbook. I’ve set the variable to prompt for value however I’m finding when I run the runbook it’s always selecting the account that has been set as the default for the variable. Is it possible override this value?

Thanks

Hi @mark.hingston

Thanks for getting in touch with Octopus and for your question!

I assume when you go to run the runbook, you see a text representation of the Azure Account like this:

Having tested this, it looks like the prompted variable selector in the runbook run screen doesn’t support showing the other accounts as a choice.

I think you are actually running into behavior similar to this issue I logged previously. That issue is for certificates but the premise is the same.

I did find a way to select a different account, but I’ll be honest, it’s less than ideal.

If you know the id of the account you want to select, you can paste it into the text box where the account should be selected.

To find the ID, you can visit the account in question, and take the last part of the URL, see below:

In the example above, the ID I’d paste in is azureserviceprincipal-octosamples-cs-demo-spaces-1

Then paste it in for the runbook run:

I’m sorry I don’t have a better answer for you.

Please let me know if you have any questions.

Best,

Thanks for your thorough reply Mark.

It is very much as you’ve described, a text representation of the account is shown for the parameter rather than a drop down. I’m finding however that when I enter another account ID it still selecting the default account bound to the variable.

I have an Azure script step in the runbook which prints out the application ID of the account as follows:

Write-Host $OctopusParameters["Azure.Account.Client"]

The script is always printing the same application ID regardless of what account I enter when running the runbook.

Kind Regards,

Mark

Hi @mark.hingston

Thank you for the additional detail. May I ask what version of Octopus you are running?

I spoke overnight with our engineers who are based in Australia, and they raised a new, more specific issue here.

It appears that the version I am running may behave differently from the version you are running, as the workaround described in the above issue does work for me (albeit with a relatively poor user experience).

Best,

Thanks again,

We’re running 2022.1.2264.

Kind Regards,

Mark.

Hi @mark.hingston

I recreated your issue on 2022.1.2264 using the example script you shared. In addition, it did appear the same on 2022.2 and 2022.3 (a pre-release version).

My previous test was flawed as the script only printed the Account ID and not the other properties. It looks like I chose the one (and only) property that did change, the ID. My apologies for any confusion as a result.

I’ve added this as a note to the latest issue. Unfortunately, I don’t have a solution to the problem as it appears to be either a bug or an unsupported variable type for prompted variables. The only thing I can suggest now is subscribing to the issue to receive updates on the issue.

Best,