Run a PowerShell script across machines in roles setup


I have a step which is a ‘Run a PowerShell script across machines in roles’.
That powershell script does the VIP swap for the current deployment.
I have it separately because in some configuration I want a human interaction to acknowledge the action before doing it.
So I also have a manual step right before the VIP swap step that will pop under specific configurations.

The problem is that when the VIP swap script runs and calls Get-AzureDeployment I get the following message:
The term ‘Get-AzureDeployment’ is not recognized as the name of a cmdlet, function, script file, or operable program.

I understabd that the azure.psd1 module is not loaded but why do I have to include the module there and not in the deploytoazure.ps1, it’s not clear.

Ok, so I added the import-module azure command but now I get the following message:
Could not establish secure channel for SSL/TLS with authority" when calling

I call the same cmdlet in the deploytoazure.ps1 script, why it isn’t working there?
What do I missed?


Hi Daniel

You are correct in that you need to load the Azure module to access the Azure cmdlets outside of the DeployToAzure.ps1 script. Each script is run in a new PowerShell process. We only automatically load the Azure module in the case of the DeployToAzure.ps1 script.

Regarding the error Could not establish secure channel for SSL/TLS with authority this is most likely due to the certificate you are using. The DeployToAzure script will also call Set-AzureSubscription with the certificate provided by octopus (Under Configuration > Certificates). So you’ll also have to do that yourself as well or use Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile to authenticate.