Extending powershell scripts with SDKs

Is it possible to extend the capabilities of powershell scripts by somehow installing SDKs such as the AWS PowerShell Tool? I’d like to use some of these scripts as separate package steps.

I’ve been trying to run Azure and AWS scripts from within Octopus. The cmdlets are available, however I’m experiencing some weird problems when running the following script from Octopus:

Import-Module -Name "Azure"
Write-Host (Get-Module Azure).Version
Select-AzureSubscription -SubscriptionId “[id]” -SubscriptionDataFile "path/to/AzureProfile.json"

This scripts works when I run it from a Powershell console. It also works when testing it by running Tentacle.exe as explained in this blog post:

Unfortunately when running an Octopus release I get the following error:

Get-AzureService : Account with name
’DA6A33EDFD4B6FD99259933EB1CAFB5B6B52C221’ does not exist.

Neither do I get anything returned from the Get-AzureAccount cmdlet. Are the scripts running in some sort of protected environment?


Thanks for reaching out! Can you try running the tentacle service using your own account and run this again? (i’m assuming your account has all the proper rights to run these azure commands)

By default the tentacle will be running as “Local system account” which sometimes can lead into situations such as these.

Let me know how it goes!