title: How can I solve this strange error with SSH Task in Azure Pipeline
body: <p>I'm trying to use the SSH deploy task in Azure devops, but I'm struggling to get it to work.</p>
  
  <h2>Steps:</h2>
  
  <ol>
  <li>I generated a ssh-key</li>
  <li>The key is added to the server</li>
  <li>(optional) tested key locally (works)</li>
  <li>Created a Service connection in Azure Devops (with the private key data and the passfrase in the password field)</li>
  <li>Allow the correct pipeline in Service connection security</li>
  <li>Added the <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/ssh?view=azure-devops" rel="nofollow noreferrer">SSH task</a> to the release pipeline.</li>
  <li>Added an inline script.</li>
  </ol>
  
  <h2>Connection succeeds</h2>
  
  <p>It seems to connect but doesn't execute the commands. I've checked the <code>/var/log/auth.log</code> file on the server and that does show a successfull connection. The authentication log on the remote server does show a successfull authentication from devops, the connects lasts exactly the value set for the timeout.</p>
  
  <h2>Wrong order, logging shows commands then connected</h2>
  
  <p>In the logging it shows my second (<code>docker-compose pull</code>) and third command (<code>docker-compose up -d</code>) but not the first command. And the commands are shown <strong>before</strong> the trying to connect line. The first command isn't shown at all.</p>
  
  <p>Did I make a mistake or is their something else going on?</p>
  
  <p>Here is the logging of the task</p>
  
  <pre><code>2020-02-12T15:05:23.7258315Z ##[section]Starting: Run SSH
  2020-02-12T15:05:23.8777631Z ==============================================================================
  2020-02-12T15:05:23.8778469Z Task         : SSH
  2020-02-12T15:05:23.8778560Z Description  : Run shell commands or a script on a remote machine using SSH
  2020-02-12T15:05:23.8778657Z Version      : 0.151.1
  2020-02-12T15:05:23.8778735Z Author       : Microsoft Corporation
  2020-02-12T15:05:23.8778839Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/ssh
  2020-02-12T15:05:23.8778953Z ==============================================================================
  2020-02-12T15:05:24.5860676Z docker-compose pull
  2020-02-12T15:05:24.5860824Z docker-compose up -d
  2020-02-12T15:05:24.5861194Z Trying to establish an SSH connection to ***@my-server.domain.com:22
  2020-02-12T15:05:25.4787782Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4789160Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4791265Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4791477Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4792286Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4792439Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4792552Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4792648Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4792757Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4792851Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4792960Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.4793055Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
  2020-02-12T15:05:25.7447781Z Successfully connected.
  2020-02-12T15:05:25.7564295Z ##[error]Unhandled: Cannot parse privateKey: Unsupported key format
  2020-02-12T15:09:23.7874932Z ##[error]The task has timed out.
  2020-02-12T15:09:23.7877908Z ##[section]Finishing: Run SSH
  </code></pre>
  
  <h2>Task YAML</h2>
  
  <pre><code>- task: SSH@0
    displayName: 'Run remote docker-compose commands'
    inputs:
      sshEndpoint: 'Endpoint name redacted'
      runOptions: inline
      inline: |
       cd ~/correct-folder/
       docker-compose pull
       docker-compose up -d
    timeoutInMinutes: 4
  
  </code></pre>
  
  <p>I've tried both Windows and Ubuntu hosted agents.</p>
  
  <h2>Unrelated issues that show same error:</h2>
  
  <ul>
  <li><a href="https://github.com/microsoft/azure-pipelines-tasks/issues/12147" rel="nofollow noreferrer">https://github.com/microsoft/azure-pipelines-tasks/issues/12147</a></li>
  <li><a href="https://stackoverflow.com/questions/55091341/node-cipheriv-warning-in-azure-devops-extension-release-task">Node Cipheriv Warning in Azure DevOps Extension - Release Task</a></li>
  <li>Issue on with node <a href="https://github.com/nodejs/node/issues/16746" rel="nofollow noreferrer">https://github.com/nodejs/node/issues/16746</a></li>
  </ul>
  
  <h2>Same issue, with explaination</h2>
  
  <p><a href="https://stackoverflow.com/a/55093077/639153">https://stackoverflow.com/a/55093077/639153</a></p>
  
  <p>It seems like the Task library is calling the wrong node function, as "solved" in march '19.</p>