Posh-SSH icon indicating copy to clipboard operation
Posh-SSH copied to clipboard

Creation a new SFTP session in an Azure Automation runbook blocks the job

Open wirelessy opened this issue 6 years ago • 4 comments

I got a runbook which uses Posh-SSH for remote SSH work. The following code seems to unregularly fail to execute, or, to pass execution back to powershell. New-SFTPSession -ComputerName xxx -Credential $cred -KeyString $aws_ssh_key -AcceptKey Following commands will not be executed, leading to infinite runtime (until Azure kills the job after 3h).

This happens on approximately 15-30% of all runbook executions. I have not found a way to implement error handling for this, since this does also not seem to work in background jobs. Background jobs in Azure using this cmdlet instantly finish, without actually executing the cmdlet.

wirelessy avatar Aug 29 '19 09:08 wirelessy

Weird I though runbooks did not had registry support. The module still depends on the registry

Sent from my iPhone

On Aug 29, 2019, at 5:21 AM, wirelessy [email protected] wrote:

I got a runbook which uses Posh-SSH for remote SSH work. The following code seems to unregularly fail to execute, or, to pass execution back to powershell. New-SFTPSession -ComputerName xxx -Credential $cred -KeyString $aws_ssh_key -AcceptKey Following commands will not be executed, leading to infinite runtime (until Azure kills the job after 3h).

This happens on approximately 15-30% of all runbook executions. I have not found a way to implement error handling for this, since this does also not seem to work in background jobs. Background jobs in Azure using this cmdlet instantly finish, without actually executing the cmdlet.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar Aug 29 '19 10:08 darkoperator

Well it works just fine - most of the time. I basically just said "Deploy to Azure Automation" and started using it. Have not seen other unexpected behaviour from it, apart from the mentioned block/timeout.

wirelessy avatar Aug 29 '19 11:08 wirelessy

Is there a way to troubleshoot this? As I mentioned, I was unable to build a workaround for this because of the execution-blocking behaviour.

wirelessy avatar Sep 05 '19 07:09 wirelessy

dont know if its linked but Ive noticed when I run Get-SFTPsession | Remove-SFTPSession at the end of processing in Azure Automation it also seems to hang holding up the runbook.

scottwaters avatar Sep 05 '19 16:09 scottwaters