Azure-pipelines-tasks: [InstallSSHKey@0] AzDO agent insufficient permissions to run SSH task when installed as a service

Created on 16 May 2020  路  6Comments  路  Source: microsoft/azure-pipelines-tasks

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: InstallSSHKey@0

Environment

  • Server - Azure Pipelines:

    • If using Azure Pipelines, provide the account name, team project name, build definition name/build number:

Account Name: fluffypaulmackinnon
Project Name: artifacts
Build Number: 46

  • Agent - Private:

    • If using private agent, provide the OS of the machine running the agent and the agent version:

Windows Server 2019 Standard Core (fresh build on VMWare with nothing else on it)
v2.168.2

Issue Description

SSH Task unable to run on Windows OS when agent software is installed with --runAsService flag. Works fine when .\run.cmd is run by a user, or when the --runAsAutoLogon flag is used (which is a user account).

Task logs

Task error log:

##[debug]Evaluating condition for step: 'Install an SSH key'
##[debug]Evaluating: succeeded()
##[debug]Evaluating succeeded:
##[debug]=> True
##[debug]Result: True
##[section]Starting: Install an SSH key
==============================================================================
Task         : Install SSH key
Description  : Install an SSH key prior to a build or deployment
Version      : 0.169.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/install-ssh-key
==============================================================================
##[debug]agent.TempDirectory=C:\vsts\_work\_temp
##[debug]loading inputs and endpoints
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading INPUT_HOSTNAME
##[debug]loading INPUT_SSHKEYSECUREFILE
##[debug]loading INPUT_SSHPUBLICKEY
##[debug]loading SECUREFILE_TICKET_dc6f1af4-5866-4786-99ed-c8dc482ea643
##[debug]loaded 7
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]sshPublicKey=asdf
##[debug]hostName=asdf
##[debug]sshPassphrase=null
##[debug]check path : C:\vsts\_work\_tasks\InstallSSHKey_5c9af2eb-5fc5-42dc-9b91-dc234a8c4400\0.169.1\task.json
##[debug]adding resource file: C:\vsts\_work\_tasks\InstallSSHKey_5c9af2eb-5fc5-42dc-9b91-dc234a8c4400\0.169.1\task.json
##[debug]system.culture=en-US
##[debug]sshKeySecureFile=dc6f1af4-5866-4786-99ed-c8dc482ea643
##[debug]System.TeamFoundationCollectionUri=https://dev.azure.com/fluffypaulmackinnon/
##[debug]SYSTEMVSSCONNECTION auth param ACCESSTOKEN = ***
##[debug]Secure file retry count set to: 5
##[debug]Agent.ProxyUrl=undefined
##[debug]secure file name for id dc6f1af4-5866-4786-99ed-c8dc482ea643 = namingstd
##[debug]Agent.TempDirectory=C:\vsts\_work\_temp
##[debug]Absolute path for pathSegments: C:\vsts\_work\_temp,namingstd = C:\vsts\_work\_temp\namingstd
##[debug]Downloading secure file contents to: C:\vsts\_work\_temp\namingstd
##[debug]secure file ticket for id dc6f1af4-5866-4786-99ed-c8dc482ea643 = ***
##[debug]SYSTEM.TEAMPROJECT=artifacts
##[debug]Downloaded secure file contents to: C:\vsts\_work\_temp\namingstd
##[debug]Agent.HomeDirectory=C:\vsts
##[debug]SSH_AGENT_PID=undefined
##[debug]SSH_AUTH_SOCK=undefined
##[debug]PID=undefined SOCK=undefined
##[debug]which 'C:\vsts\externals\Git\usr\bin\ssh-agent.exe'
##[debug]found: 'C:\vsts\externals\Git\usr\bin\ssh-agent.exe'
##[debug]which 'C:\vsts\externals\Git\usr\bin\ssh-agent.exe'
##[debug]found: 'C:\vsts\externals\Git\usr\bin\ssh-agent.exe'
##[debug]exec tool: C:\vsts\externals\Git\usr\bin\ssh-agent.exe
##[debug]exec tool: C:\vsts\externals\Git\usr\bin\ssh-agent.exe
##[debug]arguments:
##[debug]arguments:
[command]C:\vsts\externals\Git\usr\bin\ssh-agent.exe
SSH_AUTH_SOCK=/tmp/ssh-vFQHaCcQJB3H/agent.1942; export SSH_AUTH_SOCK;
SSH_AGENT_PID=1943; export SSH_AGENT_PID;
echo Agent pid 1943;
##[debug]Key=SSH_AUTH_SOCK value=/tmp/ssh-vFQHaCcQJB3H/agent.1942
##[debug]set SSH_AUTH_SOCK=/tmp/ssh-vFQHaCcQJB3H/agent.1942
##[debug]Processed: ##vso[task.setvariable variable=SSH_AUTH_SOCK;issecret=false;]/tmp/ssh-vFQHaCcQJB3H/agent.1942
##[debug]Skipping  export SSH_AUTH_SOCK
##[debug]Key=SSH_AGENT_PID value=1943
##[debug]set SSH_AGENT_PID=1943
##[debug]Processed: ##vso[task.setvariable variable=SSH_AGENT_PID;issecret=false;]1943
##[debug]Agent.Version=2.168.2
##[debug]set task variable: INSTALL_SSH_KEY_KILL_SSH_AGENT_PID=1943
##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KILL_SSH_AGENT_PID;issecret=false;]1943
##[debug]Skipping  export SSH_AGENT_PID
##[debug]Skipping 
echo Agent pid 1943
##[debug]Skipping 

##[debug]Get a list of the SSH keys in the agent
##[debug]which 'C:\vsts\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\vsts\externals\Git\usr\bin\ssh-add.exe'
##[debug]which 'C:\vsts\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\vsts\externals\Git\usr\bin\ssh-add.exe'
##[debug]C:\vsts\externals\Git\usr\bin\ssh-add.exe arg: -L
##[debug]C:\vsts\externals\Git\usr\bin\ssh-add.exe arg: -L
##[debug]exec tool: C:\vsts\externals\Git\usr\bin\ssh-add.exe
##[debug]exec tool: C:\vsts\externals\Git\usr\bin\ssh-add.exe
##[debug]arguments:
##[debug]arguments:
##[debug]   -L
##[debug]   -L
[command]C:\vsts\externals\Git\usr\bin\ssh-add.exe -L
The agent has no identities.
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\vsts\\_work\\_temp\\namingstd","/inheritance:r"]
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\vsts\\_work\\_temp\\namingstd","/inheritance:r"]
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]arguments:
##[debug]arguments:
##[debug]   C:\vsts\_work\_temp\namingstd
##[debug]   C:\vsts\_work\_temp\namingstd
##[debug]   /inheritance:r
##[debug]   /inheritance:r
[command]C:\Windows\system32\icacls.exe C:\vsts\_work\_temp\namingstd /inheritance:r
processed file: C:\vsts\_work\_temp\namingstd
Successfully processed 1 files; Failed processing 0 files
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\vsts\\_work\\_temp\\namingstd","/grant:r","WIN-RPIK5BJHU9B$:(F)"]
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\vsts\\_work\\_temp\\namingstd","/grant:r","WIN-RPIK5BJHU9B$:(F)"]
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]arguments:
##[debug]arguments:
##[debug]   C:\vsts\_work\_temp\namingstd
##[debug]   C:\vsts\_work\_temp\namingstd
##[debug]   /grant:r
##[debug]   /grant:r
##[debug]   WIN-RPIK5BJHU9B$:(F)
##[debug]   WIN-RPIK5BJHU9B$:(F)
[command]C:\Windows\system32\icacls.exe C:\vsts\_work\_temp\namingstd /grant:r WIN-RPIK5BJHU9B$:(F)
Successfully processed 0 files; Failed processing 1 files
WIN-RPIK5BJHU9B$: No mapping between account names and security IDs was done.
##[debug]task result: Failed
##[error]Error: EPERM: operation not permitted, chmod 'C:\vsts\_work\_temp\namingstd'
##[debug]Processed: ##vso[task.issue type=error;]Error: EPERM: operation not permitted, chmod 'C:\vsts\_work\_temp\namingstd'
(node:1804) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: EPERM: operation not permitted, stat 'C:\vsts\_work\_temp\namingstd'
##[debug]Processed: ##vso[task.complete result=Failed;]Error: EPERM: operation not permitted, chmod 'C:\vsts\_work\_temp\namingstd'
##[debug]secure file name for id dc6f1af4-5866-4786-99ed-c8dc482ea643 = namingstd
##[debug]Agent.TempDirectory=C:\vsts\_work\_temp
##[debug]Absolute path for pathSegments: C:\vsts\_work\_temp,namingstd = C:\vsts\_work\_temp\namingstd
##[section]Finishing: Install an SSH key

Check perms of folder:

PS C:\vsts> .\config.cmd --unattended --url https://dev.azure.com/fluffypaulmackinnon --auth "pat" --token "" --pool "qwer" --agent "WIN-RPIK5BJHU9B" --acceptTeeEula --runAsService --replace

  ___                      ______ _            _ _
 / _ \                     | ___ (_)          | (_)
/ /_\ \_____   _ _ __ ___  | |_/ /_ _ __   ___| |_ _ __   ___  ___
|  _  |_  / | | | '__/ _ \ |  __/| | '_ \ / _ \ | | '_ \ / _ \/ __|
| | | |/ /| |_| | | |  __/ | |   | | |_) |  __/ | | | | |  __/\__ \
\_| |_/___|\__,_|_|  \___| \_|   |_| .__/ \___|_|_|_| |_|\___||___/
                                   | |
        agent v2.168.2             |_|          (commit 180d386)


>> Connect:

Connecting to server ...

>> Register Agent:

Scanning for tool capabilities.
Connecting to the server.
Successfully added the agent
Testing agent connection.
2020-05-16 10:22:11Z: Settings Saved.
Granting file permissions to 'NT AUTHORITY\NETWORK SERVICE'.
Service vstsagent.fluffypaulmackinnon.qwer.WIN-RPIK5BJHU9B successfully installed
Service vstsagent.fluffypaulmackinnon.qwer.WIN-RPIK5BJHU9B successfully set recovery option
Service vstsagent.fluffypaulmackinnon.qwer.WIN-RPIK5BJHU9B successfully set to delayed auto start
Service vstsagent.fluffypaulmackinnon.qwer.WIN-RPIK5BJHU9B successfully configured
Service vstsagent.fluffypaulmackinnon.qwer.WIN-RPIK5BJHU9B started successfully


PS C:\vsts> $access = Get-Acl
PS C:\vsts> $access.Access


FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : WIN-RPIK5BJHU9B\VSTS_AgentService_G39071
IsInherited       : False
InheritanceFlags  : ContainerInherit, ObjectInherit
PropagationFlags  : None

FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited       : True
InheritanceFlags  : ContainerInherit, ObjectInherit
PropagationFlags  : None

FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited       : True
InheritanceFlags  : ContainerInherit, ObjectInherit
PropagationFlags  : None

FileSystemRights  : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : BUILTIN\Users
IsInherited       : True
InheritanceFlags  : ContainerInherit, ObjectInherit
PropagationFlags  : None

FileSystemRights  : AppendData
AccessControlType : Allow
IdentityReference : BUILTIN\Users
IsInherited       : True
InheritanceFlags  : ContainerInherit
PropagationFlags  : None

FileSystemRights  : CreateFiles
AccessControlType : Allow
IdentityReference : BUILTIN\Users
IsInherited       : True
InheritanceFlags  : ContainerInherit
PropagationFlags  : None

FileSystemRights  : 268435456
AccessControlType : Allow
IdentityReference : CREATOR OWNER
IsInherited       : True
InheritanceFlags  : ContainerInherit, ObjectInherit
PropagationFlags  : InheritOnly

Successful task log when AzDO agent run as a user:

##[debug]Evaluating condition for step: 'Install an SSH key'
##[debug]Evaluating: succeeded()
##[debug]Evaluating succeeded:
##[debug]=> True
##[debug]Result: True
##[section]Starting: Install an SSH key
==============================================================================
Task         : Install SSH key
Description  : Install an SSH key prior to a build or deployment
Version      : 0.169.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/install-ssh-key
==============================================================================
##[debug]agent.TempDirectory=C:\agent\_work\_temp
##[debug]loading inputs and endpoints
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading INPUT_HOSTNAME
##[debug]loading INPUT_SSHKEYSECUREFILE
##[debug]loading INPUT_SSHPUBLICKEY
##[debug]loading SECUREFILE_TICKET_dc6f1af4-5866-4786-99ed-c8dc482ea643
##[debug]loaded 7
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]sshPublicKey=asdf
##[debug]hostName=asdf
##[debug]sshPassphrase=null
##[debug]check path : C:\agent\_work\_tasks\InstallSSHKey_5c9af2eb-5fc5-42dc-9b91-dc234a8c4400\0.169.1\task.json
##[debug]adding resource file: C:\agent\_work\_tasks\InstallSSHKey_5c9af2eb-5fc5-42dc-9b91-dc234a8c4400\0.169.1\task.json
##[debug]system.culture=en-US
##[debug]sshKeySecureFile=dc6f1af4-5866-4786-99ed-c8dc482ea643
##[debug]System.TeamFoundationCollectionUri=https://dev.azure.com/fluffypaulmackinnon/
##[debug]SYSTEMVSSCONNECTION auth param ACCESSTOKEN = ***
##[debug]Secure file retry count set to: 5
##[debug]Agent.ProxyUrl=undefined
##[debug]secure file name for id dc6f1af4-5866-4786-99ed-c8dc482ea643 = namingstd
##[debug]Agent.TempDirectory=C:\agent\_work\_temp
##[debug]Absolute path for pathSegments: C:\agent\_work\_temp,namingstd = C:\agent\_work\_temp\namingstd
##[debug]Downloading secure file contents to: C:\agent\_work\_temp\namingstd
##[debug]secure file ticket for id dc6f1af4-5866-4786-99ed-c8dc482ea643 = ***
##[debug]SYSTEM.TEAMPROJECT=artifacts
##[debug]Downloaded secure file contents to: C:\agent\_work\_temp\namingstd
##[debug]Agent.HomeDirectory=C:\agent
##[debug]SSH_AGENT_PID=undefined
##[debug]SSH_AUTH_SOCK=undefined
##[debug]PID=undefined SOCK=undefined
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-agent.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-agent.exe'
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-agent.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-agent.exe'
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-agent.exe
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-agent.exe
##[debug]arguments:
##[debug]arguments:
[command]C:\agent\externals\Git\usr\bin\ssh-agent.exe
SSH_AUTH_SOCK=/tmp/ssh-2rVhjWyUZ6VP/agent.1846; export SSH_AUTH_SOCK;
SSH_AGENT_PID=1847; export SSH_AGENT_PID;
echo Agent pid 1847;
##[debug]Key=SSH_AUTH_SOCK value=/tmp/ssh-2rVhjWyUZ6VP/agent.1846
##[debug]set SSH_AUTH_SOCK=/tmp/ssh-2rVhjWyUZ6VP/agent.1846
##[debug]Processed: ##vso[task.setvariable variable=SSH_AUTH_SOCK;issecret=false;]/tmp/ssh-2rVhjWyUZ6VP/agent.1846
##[debug]Skipping  export SSH_AUTH_SOCK
##[debug]Key=SSH_AGENT_PID value=1847
##[debug]set SSH_AGENT_PID=1847
##[debug]Processed: ##vso[task.setvariable variable=SSH_AGENT_PID;issecret=false;]1847
##[debug]Agent.Version=2.168.2
##[debug]set task variable: INSTALL_SSH_KEY_KILL_SSH_AGENT_PID=1847
##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KILL_SSH_AGENT_PID;issecret=false;]1847
##[debug]Skipping  export SSH_AGENT_PID
##[debug]Skipping 
echo Agent pid 1847
##[debug]Skipping 

##[debug]Get a list of the SSH keys in the agent
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]C:\agent\externals\Git\usr\bin\ssh-add.exe arg: -L
##[debug]C:\agent\externals\Git\usr\bin\ssh-add.exe arg: -L
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-add.exe
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-add.exe
##[debug]arguments:
##[debug]arguments:
##[debug]   -L
##[debug]   -L
[command]C:\agent\externals\Git\usr\bin\ssh-add.exe -L
The agent has no identities.
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\agent\\_work\\_temp\\namingstd","/inheritance:r"]
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\agent\\_work\\_temp\\namingstd","/inheritance:r"]
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]arguments:
##[debug]arguments:
##[debug]   C:\agent\_work\_temp\namingstd
##[debug]   C:\agent\_work\_temp\namingstd
##[debug]   /inheritance:r
##[debug]   /inheritance:r
[command]C:\Windows\system32\icacls.exe C:\agent\_work\_temp\namingstd /inheritance:r
processed file: C:\agent\_work\_temp\namingstd
Successfully processed 1 files; Failed processing 0 files
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]which 'icacls'
##[debug]found: 'C:\Windows\system32\icacls.exe'
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\agent\\_work\\_temp\\namingstd","/grant:r","paul:(F)"]
##[debug]C:\Windows\system32\icacls.exe arg: ["C:\\agent\\_work\\_temp\\namingstd","/grant:r","paul:(F)"]
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]exec tool: C:\Windows\system32\icacls.exe
##[debug]arguments:
##[debug]arguments:
##[debug]   C:\agent\_work\_temp\namingstd
##[debug]   C:\agent\_work\_temp\namingstd
##[debug]   /grant:r
##[debug]   /grant:r
##[debug]   paul:(F)
##[debug]   paul:(F)
[command]C:\Windows\system32\icacls.exe C:\agent\_work\_temp\namingstd /grant:r paul:(F)
processed file: C:\agent\_work\_temp\namingstd
Successfully processed 1 files; Failed processing 0 files
##[debug]Checking for public SSH key: asdf
##[debug]Adding the SSH key to the agent C:\agent\_work\_temp\namingstd
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]C:\agent\externals\Git\usr\bin\ssh-add.exe arg: C:\agent\_work\_temp\namingstd
##[debug]C:\agent\externals\Git\usr\bin\ssh-add.exe arg: C:\agent\_work\_temp\namingstd
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-add.exe
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-add.exe
##[debug]arguments:
##[debug]arguments:
##[debug]   C:\agent\_work\_temp\namingstd
##[debug]   C:\agent\_work\_temp\namingstd
[command]C:\agent\externals\Git\usr\bin\ssh-add.exe C:\agent\_work\_temp\namingstd
Identity added: C:\agent\_work\_temp\namingstd (asdf)
##[debug]Agent.Version=2.168.2
##[debug]set task variable: INSTALL_SSH_KEY_DELETE_KEY=C:\agent\_work\_temp\namingstd
##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_DELETE_KEY;issecret=false;]C:\agent\_work\_temp\namingstd
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]which 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]found: 'C:\agent\externals\Git\usr\bin\ssh-add.exe'
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-add.exe
##[debug]exec tool: C:\agent\externals\Git\usr\bin\ssh-add.exe
##[debug]arguments:
##[debug]arguments:
[command]C:\agent\externals\Git\usr\bin\ssh-add.exe
##[debug]Agent.Version=2.168.2
##[debug]set task variable: INSTALL_SSH_KEY_KNOWN_HOSTS_CONTENTS=
##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KNOWN_HOSTS_CONTENTS;issecret=false;]
##[debug]Agent.Version=2.168.2
##[debug]set task variable: INSTALL_SSH_KEY_KNOWN_HOSTS_LOCATION=C:\Users\paul\.ssh\known_hosts
##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KNOWN_HOSTS_LOCATION;issecret=false;]C:\Users\paul\.ssh\known_hosts
##[debug]Agent.Version=2.168.2
##[debug]set task variable: INSTALL_SSH_KEY_KNOWN_HOSTS_FILE_DELETE=true
##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KNOWN_HOSTS_FILE_DELETE;issecret=false;]true
##[debug]Inserting entry into known_hosts
##[debug]secure file name for id dc6f1af4-5866-4786-99ed-c8dc482ea643 = namingstd
##[debug]Agent.TempDirectory=C:\agent\_work\_temp
##[debug]Absolute path for pathSegments: C:\agent\_work\_temp,namingstd = C:\agent\_work\_temp\namingstd
##[debug]Deleting secure file at: C:\agent\_work\_temp\namingstd
##[debug]rm -rf C:\agent\_work\_temp\namingstd
##[debug]removing file
##[debug]End
##[section]Finishing: Install an SSH key

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs

See above.

ABTT bug

All 6 comments

I've had the same issue while upgrading Azure DevOps Server to Azure DevOs Services. The self-hosted agents started an update, to version 2.169.1, and since then the task has been unable to succeed.

Hello, any resolution as it is blocking us from any builds and deployments.

Starting: Install an SSH key

Task : Install SSH key
Description : Install an SSH key prior to a build or deployment
Version : 0.170.1
Author : Microsoft Corporation

Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/install-ssh-key

C:\agent\externals\Git\usr\bin\ssh-agent.exe
SSH_AUTH_SOCK=/tmp/ssh-LYUVD5kmwYQ9/agent.733; export SSH_AUTH_SOCK;
SSH_AGENT_PID=734; export SSH_AGENT_PID;
echo Agent pid 734;
C:\agent\externals\Git\usr\bin\ssh-add.exe -L
The agent has no identities.
C:\Windows\system32\icacls.exe E:\Agents_work_temp\azure_devops /inheritance:r
processed file: E:\Agents_work_temp\azure_devops
Successfully processed 1 files; Failed processing 0 files
C:\Windows\system32\icacls.exe E:\Agents_work_temp\azure_devops /grant:r CIVVSTSNET01$:(F)
processed file: E:\Agents_work_temp\azure_devops
Successfully processed 1 files; Failed processing 0 files

[error]Error: EPERM: operation not permitted, chmod 'E:\Agents_work_temp\azure_devops'

(node:4216) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: EPERM: operation not permitted, stat 'E:\Agents_work_temp\azure_devops'
Finishing: Install an SSH key

Hello, any resolution as it is blocking us from any builds and deployments.

Running the agent as an user (i.e. running the run.bat file) as described by @fluffy-cakes was a functional workaround for me

Looking for possible causes, I discovered that this change was intentionally designed: https://github.com/microsoft/azure-pipelines-tasks/pull/12735#pullrequestreview-399938533
What I don't understand just yet is why it functioned before, when user mode was not required.

Thanks for opening the issue!
It may take some time for the fix to be deployed. You may also try to change logon account to the local system account for the agent running as a service as a temporary workaround.
In order to do it, you may open "Services", find "Azure Pipelines Agent" in the service list, open it's properties and set 'Log on as' property to 'Local System account' at Log On tab.
Running agent as user as it was mentioned above should also help.
I'll let you know once the fix is deployed.

Closing the issue since changes should be deployed now. Please feel free to reopen.

Was this page helpful?
0 / 5 - 0 ratings