Posh-SSH: Session operation has timed out inside Azure Automation

I am trying to use Posh-SSH in an Azure Automation Runbook in order to run something on a Linux VM. My script

$password = Convertto-SecureString -String "xxxxxxx" -AsPlainText -Force
$cred = New-Object -Typename System.Management.Automation.PSCredential -ArgumentList numbers, $password
$ssh = New-SSHSession -ComputerName "example.com" -Credential $cred -AcceptKey -ConnectionTimeOut 100
$(Invoke-SSHCommand -Index 0 -Command "echo dog").Output 

runs fine from my command line, but in Azure Automation I get the error

Session operation has timed out

which is why I extended the timeout. Do you know whether Posh-SSH operate in this environment?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 27 (10 by maintainers)

Most upvoted comments

I had the same issue. It works with a “-ConnectionTimeout” value