Run Azure Powershell script account

(Scott Taylor) #1

Hello,

I have created an Azure Powershell step template. I have added a paramater called ‘ServiceAccount’ that is a type ‘Azure Account’. I have bound the Account under the step tab to the paramater ServiceAccount, however when i try to run it there are no accounts to choose from. If i unbind the account in the step tamplate I can select an account, however I need to run the script across multiple account (dev/production).

Is this a bug?

Thanks

Scott

(Kenneth Bates) #3

Hi Scott,

Thanks for getting in touch! I’m unable to determine precisely what’s causing this issue, or if it’s a bug (though it seems to work as expected in my testing, but I may be misinterpreting something). Would you be willing to elaborate a bit further and send some screenshots showing the step template and Azure Account variable configurations? This will help me better understand your scenario and give it a test as you have it setup. :slight_smile:

I look forward to hearing back and getting to the bottom of this one!

Best regards,

Kenny

(Scott Taylor) #4

Hi Kenny,

Thanks for looking.

This is the step template. As you can see all the accounts are there when I select an account under the step

However this will only one against one account. I need to use this for dev and production so I need to pass it in as a parameter:

It is now bound to the ServiceAccount parameter which is a type of AzureAccount. However when I use it in the process or test it I get:

Nothing to select.

Thanks

Scott

(Kenneth Bates) #5

Hi Scott,

Many thanks for following up and expanding on your setup. Do you have Azure Account variables set up in your project (either as project variables or variables in a set)? These variables will populate the dropdown when viewing it as part of the project’s deployment process, whereas all Azure Accounts in Octopus will be shown when viewing the dropdown as part of the custom step template in the library (as these are global).

We have some additional information about these variables in the following documentation page.

I hope that helps! Let me know if you have any further questions or concerns going forward.

Best regards,

Kenny

(Scott Taylor) #6

Hi Kenny,

Yes that populates it. Thanks for your help

Scott

(Scott Taylor) #7

HI Kenny,

I have just tried setting this up and now I am getting this:

There is a variable called AzureAccount:

And the step is set up like this:

Thanks

Scott

(Scott Taylor) #8

Hi Kenny,

Any update on this? Can you confirm if it’s a bug or not please?

Thanks

Scott

(Kenneth Bates) #9

Hi Scott,

Thanks for following up, and my sincere apologies about the delay in getting back to you. I unfortunately didn’t see your messages come through and only saw as a result of the GitHub issue you linked this thread in.

I’ve been able to reproduce this behavior, and sure enough it’s a bug as it seems to be searching for the variable name instead of the Azure Account name when attempting to deploy. I’ve raised this issue at the following link for you to track.

I was able to work around this by renaming my variable to match the Azure Account ID exactly and then updating the binding in the step template to match this variable name change. You can get the Azure Account ID in the URL when viewing the account in the web portal. The ID is after the /accounts/ in the URL as I’ve highlighted below.

We’ve had recent reports of a bug that is very similar (and maybe has the exact same root cause). I can’t confirm at this stage if it’s an exact match, but it may only require upgrading to 2019.7.0 once it’s shipped as that will include the fix to that bug. You can reference that issue here.

I’m going to attempt to reproduce this once again when 2019.7.0 is available and I’ll let you know the outcome.

I’m very sorry again for the lack of communication on my part, and I’ve bookmarked this thread to ensure it won’t happen again.

Best regards,

Kenny

(Scott Taylor) #10

HI Kenneth,

No problems. The main thing is the bug has been identified and will get fixed as its causing me some headaches at the moment!

Thanks for your help

Scott

1 Like
(Scott Taylor) #11

Hi Kenny,

Just to let you know I have just upgraded to 2019.7.0 and the issue is still happening. Do you think this will be fixed as a priority? I cant use the work around below as I need to choose the service
account based on environment.

Thanks

Scott

: Kenneth Bates via Octopus Deploy support@octopus.com

(Kenneth Bates) #12

Hi Scott,

I’m very sorry for the delay in getting back to you on this one. I got your email and just wanted to message here as well in case you see it sooner. Both issues (5674 and 5620) have been given priority and fixes for both of them should be completed in the next couple of days. I’ll message you directly here as soon as we ship a version that includes the bug fixes.

Best regards,

Kenny