question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Copy files over SSH: Cannot parse privateKey

See original GitHub issue

Question, Bug, or Feature?
Type: Bug

Enter Task Name: Copy files over SSH

Environment

  • Server - Azure Pipelines
  • Agent - Hosted

Issue Description

Copy files over SSH does not work with a private key. I am able to connect with username and passwort only but not with a private key. In the error log is visible that “Cannot parse privateKey: Unsupported key format”, however I tried multiple versions like:

ssh-keygen -t rsa -b 2048
ssh-keygen -t rsa -m PEM -b 2048
ssh-keygen -t rsa -m PEM

I used powershell version 5.1.18362.145 for the key generation.

I also stumbled over Issue 8818 which is already closed, however the same keygen options do not work for me.

My service connection looks like the following service_connection

My pipline like: pipline

Error logs

[2019-09-26T17:24:57.5708149Z ============================================================================== 2019-09-26T17:24:57.5708283Z Task : Copy files over SSH 2019-09-26T17:24:57.5708379Z Description : Copy files or build artifacts to a remote machine over SSH 2019-09-26T17:24:57.5708485Z Version : 0.151.1 2019-09-26T17:24:57.5708570Z Author : Microsoft Corporation 2019-09-26T17:24:57.5708684Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/copy-files-over-ssh 2019-09-26T17:24:57.5708804Z ============================================================================== 2019-09-26T17:24:58.1932243Z ##[debug]agent.workFolder=d:\a 2019-09-26T17:24:58.1938497Z ##[debug]loading inputs and endpoints 2019-09-26T17:24:58.1943022Z ##[debug]loading ENDPOINT_AUTH_93ebd23f-ee98-41a1-8ff1-6361292f2e0d 2019-09-26T17:24:58.1945702Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_93ebd23f-ee98-41a1-8ff1-6361292f2e0d_PASSWORD 2019-09-26T17:24:58.1948155Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_93ebd23f-ee98-41a1-8ff1-6361292f2e0d_USERNAME 2019-09-26T17:24:58.1948949Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2019-09-26T17:24:58.1949268Z ##[debug]loading ENDPOINT_AUTH_SCHEME_93ebd23f-ee98-41a1-8ff1-6361292f2e0d 2019-09-26T17:24:58.1949554Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2019-09-26T17:24:58.1949821Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2019-09-26T17:24:58.1950086Z ##[debug]loading INPUT_CLEANTARGETFOLDER 2019-09-26T17:24:58.1950347Z ##[debug]loading INPUT_CONTENTS 2019-09-26T17:24:58.1950694Z ##[debug]loading INPUT_FAILONEMPTYSOURCE 2019-09-26T17:24:58.1951023Z ##[debug]loading INPUT_FLATTENFOLDERS 2019-09-26T17:24:58.1951287Z ##[debug]loading INPUT_OVERWRITE 2019-09-26T17:24:58.1951549Z ##[debug]loading INPUT_SOURCEFOLDER 2019-09-26T17:24:58.1951803Z ##[debug]loading INPUT_SSHENDPOINT 2019-09-26T17:24:58.1952078Z ##[debug]loading INPUT_TARGETFOLDER 2019-09-26T17:24:58.1952336Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN 2019-09-26T17:24:58.1952590Z ##[debug]loaded 16 2019-09-26T17:24:58.1952858Z ##[debug]check path : d:\a_tasks\CopyFilesOverSSH_67cec91b-0351-4c2f-8465-d74b3d2a2d96\0.151.1\task.json 2019-09-26T17:24:58.1953150Z ##[debug]set resource file to: d:\a_tasks\CopyFilesOverSSH_67cec91b-0351-4c2f-8465-d74b3d2a2d96\0.151.1\task.json 2019-09-26T17:24:58.1953426Z ##[debug]system.culture=en-US 2019-09-26T17:24:58.1953689Z ##[debug]sshEndpoint=93ebd23f-ee98-41a1-8ff1-6361292f2e0d 2019-09-26T17:24:58.1954066Z ##[debug]93ebd23f-ee98-41a1-8ff1-6361292f2e0d auth param username = *** 2019-09-26T17:24:58.1954687Z ##[debug]93ebd23f-ee98-41a1-8ff1-6361292f2e0d auth param password = *** 2019-09-26T17:24:58.1954886Z ##[debug]93ebd23f-ee98-41a1-8ff1-6361292f2e0d data host = my-server.com 2019-09-26T17:24:58.1955061Z ##[debug]93ebd23f-ee98-41a1-8ff1-6361292f2e0d data port = 22 2019-09-26T17:24:58.1955410Z ##[debug]Using private key for ssh connection. 2019-09-26T17:24:58.1955673Z ##[debug]contents=** 2019-09-26T17:24:58.1956288Z ##[debug]sourceFolder=d:\a\1\s\scripts\doc 2019-09-26T17:24:58.1956713Z ##[debug]check path : d:\a\1\s\scripts\doc 2019-09-26T17:24:58.1956988Z ##[debug]targetFolder=/home/test 2019-09-26T17:24:58.1957249Z ##[debug]cleanTargetFolder=true 2019-09-26T17:24:58.1957507Z ##[debug]overwrite=true 2019-09-26T17:24:58.1957758Z ##[debug]failOnEmptySource=true 2019-09-26T17:24:58.1958055Z ##[debug]flattenFolders=false 2019-09-26T17:24:58.1958285Z Setting up SSH service connection to remote host my-server.com. 2019-09-26T17:24:58.1958555Z ##[debug]task result: Failed 2019-09-26T17:24:58.2015161Z ##[error]Error: Failed to connect to remote machine. Verify the SSH service connection details. Error: Cannot parse privateKey: Unsupported key format. 2019-09-26T17:24:58.2025471Z ##[debug]Processed: ##vso[task.issue type=error;]Error: Failed to connect to remote machine. Verify the SSH service connection details. Error: Cannot parse privateKey: Unsupported key format. 2019-09-26T17:24:58.2042179Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: Failed to connect to remote machine. Verify the SSH service connection details. Error: Cannot parse privateKey: Unsupported key format. 2019-09-26T17:24:58.2042504Z ##[debug]Closing the client connection 2019-09-26T17:24:58.2071986Z ##[section]Finishing: CopyFilesOverSSH]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13

github_iconTop GitHub Comments

8reactions
epsmaecommented, Oct 24, 2019

Official there is this manual: https://docs.microsoft.com/en-us/azure/devops/project/navigation/preview-features?view=azure-devops

For me it looks a bit different: Click right top on your name then press the “…” behind azure devops profile and then select preview features.

5reactions
epsmaecommented, Oct 20, 2019

I finally found a workaround: The preview feature “service connection” has to be disabled. Without the preview feature enabled there is a button “Upload SSH private key file…”. The same key files as before works perfect.

grafik

Read more comments on GitHub >

github_iconTop Results From Across the Web

Copy Files Over SSH: Cannot parse privateKey: Unsupported ...
Issue Description. Task name: Copy Files Over SSH. The task is not able to parse the ssh private key, provided by the endpoint...
Read more >
Copy files over SSH failed "Error: Cannot parse privateKey
Using the same SSH Service Connection and it's just fine with other SSH tasks but copying files seems to run into trouble.
Read more >
Verify the SSH service connection details. Error
Verify the SSH service connection details. Error: Error: Cannot parse privateKey: Unsupported key format.
Read more >
Use SSH keys to communicate with GitLab
Support for Git over SSH · Upgrade the Operator ... Parse logs with jq ... Migrate projects using file exports · Troubleshooting.
Read more >
Invalid SSH Key | Bitbucket Cloud Cloud KB
This error means that the data copied into the form was not able to be parsed to extract something that "looks like an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found