Copy files over SSH: Cannot parse privateKey
See original GitHub issueQuestion, 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
My pipline like:
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:
- Created 4 years ago
- Reactions:2
- Comments:13
Top GitHub Comments
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.
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.