Skip to content

[BUG]: 'tr' not recognized as command when both Agent OS and Target VM OS are Windows #21444

@ahaleiii

Description

@ahaleiii

New issue checklist

Task name

SSH

Task version

0.259.0

Issue Description

Conditions:

  • Agent OS: Windows
  • Target VM OS: Windows
  • runOptions: 'inline'

It appears that the task wants to change line endings if the Agent OS is Windows, but it attempts to do so using tr which I am assuming is a Unix tool not available on Windows Command Prompt.

I believe this is the relevant code.

My initial thought is that this block should be skipped if the target VM is also running Windows.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows Server 2019

Relevant log output

##[error]'tr' is not recognized as an internal or external command,
operable program or batch file.

Full task logs with system.debug enabled

2025-11-12T18:21:31.1184901Z ##[debug]Evaluating condition for step: 'Run My Script'
2025-11-12T18:21:31.1186307Z ##[debug]Evaluating: SucceededNode()
2025-11-12T18:21:31.1186664Z ##[debug]Evaluating SucceededNode:
2025-11-12T18:21:31.1187465Z ##[debug]=> True
2025-11-12T18:21:31.1187876Z ##[debug]Result: True
2025-11-12T18:21:31.1188873Z ##[section]Starting: Run My Script
2025-11-12T18:21:31.1202003Z ==============================================================================
2025-11-12T18:21:31.1202209Z Task         : SSH
2025-11-12T18:21:31.1202307Z Description  : Run shell commands or a script on a remote machine using SSH
2025-11-12T18:21:31.1202446Z Version      : 0.259.0
2025-11-12T18:21:31.1202557Z Author       : Microsoft Corporation
2025-11-12T18:21:31.1202660Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/ssh
2025-11-12T18:21:31.1202812Z ==============================================================================
2025-11-12T18:21:31.1670729Z ##[debug]Using node path: C:\azdo\agent001\externals\node20_1\bin\node.exe
2025-11-12T18:21:31.7993657Z ##[debug]system.debug=True
2025-11-12T18:21:31.7994554Z ##[debug]DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff=True
2025-11-12T18:21:31.8110206Z ##[debug]agent.TempDirectory=C:\azdo\agent001\_work\_temp
2025-11-12T18:21:31.8135907Z ##[debug]loading inputs and endpoints
2025-11-12T18:21:31.8178637Z ##[debug]loading ENDPOINT_AUTH_11122233-3444-5556-6677-7888999aaabb
2025-11-12T18:21:31.8209113Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_11122233-3444-5556-6677-7888999aaabb_PASSWORD
2025-11-12T18:21:31.8215770Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_11122233-3444-5556-6677-7888999aaabb_USERNAME
2025-11-12T18:21:31.8222862Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2025-11-12T18:21:31.8229546Z ##[debug]loading ENDPOINT_AUTH_SCHEME_11122233-3444-5556-6677-7888999aaabb
2025-11-12T18:21:31.8236255Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2025-11-12T18:21:31.8244769Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2025-11-12T18:21:31.8252991Z ##[debug]loading INPUT_FAILONSTDERR
2025-11-12T18:21:31.8264088Z ##[debug]loading INPUT_INLINE
2025-11-12T18:21:31.8270141Z ##[debug]loading INPUT_INTERACTIVEKEYBOARDAUTHENTICATION
2025-11-12T18:21:31.8277668Z ##[debug]loading INPUT_INTERACTIVESESSION
2025-11-12T18:21:31.8286619Z ##[debug]loading INPUT_READYTIMEOUT
2025-11-12T18:21:31.8293697Z ##[debug]loading INPUT_RUNOPTIONS
2025-11-12T18:21:31.8303460Z ##[debug]loading INPUT_SCRIPTPATH
2025-11-12T18:21:31.8310616Z ##[debug]loading INPUT_SSHENDPOINT
2025-11-12T18:21:31.8320090Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2025-11-12T18:21:31.8335308Z ##[debug]loaded 16
2025-11-12T18:21:31.8344015Z ##[debug]Agent.ProxyUrl=undefined
2025-11-12T18:21:31.8346916Z ##[debug]Agent.CAInfo=undefined
2025-11-12T18:21:31.8347530Z ##[debug]Agent.ClientCert=undefined
2025-11-12T18:21:31.8348145Z ##[debug]Agent.SkipCertValidation=undefined
2025-11-12T18:21:31.9997098Z ##[debug]check path : C:\azdo\agent001\_work\_tasks\SSH_91443475-df55-4874-944b-39253b558790\0.259.0\task.json
2025-11-12T18:21:32.0001663Z ##[debug]adding resource file: C:\azdo\agent001\_work\_tasks\SSH_91443475-df55-4874-944b-39253b558790\0.259.0\task.json
2025-11-12T18:21:32.0002357Z ##[debug]system.culture=en-US
2025-11-12T18:21:32.0043352Z ##[debug]sshEndpoint=11122233-3444-5556-6677-7888999aaabb
2025-11-12T18:21:32.0048842Z ##[debug]interactiveKeyboardAuthentication=false
2025-11-12T18:21:32.0056612Z ##[debug]11122233-3444-5556-6677-7888999aaabb auth param username = ***
2025-11-12T18:21:32.0062053Z ##[debug]11122233-3444-5556-6677-7888999aaabb auth param password = ***
2025-11-12T18:21:32.0063276Z ##[debug]11122233-3444-5556-6677-7888999aaabb data host = 10.11.12.13
2025-11-12T18:21:32.0063963Z ##[debug]11122233-3444-5556-6677-7888999aaabb data port = 22
2025-11-12T18:21:32.0069818Z ##[debug]interactiveSession=false
2025-11-12T18:21:32.0076726Z ##[debug]readyTimeout=20000
2025-11-12T18:21:32.0077404Z ##[debug]Using username and password for ssh connection.
2025-11-12T18:21:32.0082453Z ##[debug]runOptions=inline
2025-11-12T18:21:32.0088835Z ##[debug]inline=set SECRET_ENV_VAR01=***
set SECRET_ENV_VAR02=***
powershell.exe -ExecutionPolicy Bypass -File "C:\temp\my-powershell-script.ps1"
2025-11-12T18:21:32.0089578Z ##[debug]interpreterCommand=undefined
2025-11-12T18:21:32.0090143Z ##[debug]Agent.TempDirectory=C:\azdo\agent001\_work\_temp
2025-11-12T18:21:32.0116454Z ##[debug]failOnStdErr=false
2025-11-12T18:21:32.0152136Z Trying to establish an SSH connection to ***@10.11.12.13:22
2025-11-12T18:21:32.8654933Z Successfully connected.
2025-11-12T18:21:32.8655794Z ##[debug]remoteScriptPath = ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb
2025-11-12T18:21:32.8656516Z ##[debug]Copying script to remote machine.
2025-11-12T18:21:34.6094101Z ##[debug]Copied script file to remote machine at: ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb
2025-11-12T18:21:34.7156440Z ##[debug]sftpClient: Ignoring error diconnecting: Error: read ECONNRESET
2025-11-12T18:21:34.7167161Z ##[debug]Fixing the line endings in case the file was created in Windows
2025-11-12T18:21:34.7168801Z tr -d '\015' <./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb> ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb._unix
2025-11-12T18:21:34.7169474Z ##[debug]Removing Windows CR LF from ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb
2025-11-12T18:21:34.7171326Z ##[debug]command = tr -d '\015' <./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb> ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb._unix
2025-11-12T18:21:34.9355623Z ##[debug]stderr = 'tr' is not recognized as an internal or external command,
operable program or batch file.

2025-11-12T18:21:34.9382603Z ##[error]'tr' is not recognized as an internal or external command,
operable program or batch file.

2025-11-12T18:21:34.9390718Z ##[debug]Processed: ##vso[task.issue type=error;source=CustomerScript;correlationId=d237194d-5f86-407d-a75b-733a2fa9826e;]'tr' is not recognized as an internal or external command,
operable program or batch file.

2025-11-12T18:21:34.9391838Z ##[debug]code = 1, signal = undefined
2025-11-12T18:21:34.9392320Z ##[debug]task result: Failed
2025-11-12T18:21:34.9394203Z ##[error]Command tr -d '\015' <./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb> ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb._unix exited with code 1.
2025-11-12T18:21:34.9395179Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=d237194d-5f86-407d-a75b-733a2fa9826e;]Command tr -d '\015' <./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb> ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb._unix exited with code 1.
2025-11-12T18:21:34.9396803Z ##[debug]Processed: ##vso[task.complete result=Failed;]Command tr -d '\015' <./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb> ./sshscript_79641c2e-6f28-4a32-842e-b48d24de72eb._unix exited with code 1.
2025-11-12T18:21:34.9397461Z ##[debug]Closing the SSH client connection.
2025-11-12T18:21:35.0613365Z ##[section]Finishing: Run My Script

Repro steps

# AZDO Agent is running Windows
# Target VM is also running Windows
- task: SSH@0
  displayName: 'Run My Script'
  inputs:
    sshEndpoint: '11122233-3444-5556-6677-7888999aaabb'
    runOptions: 'inline'
    interpreterCommand: ''
    inline: |
      set SECRET_ENV_VAR01=$(MySecret01)
      set SECRET_ENV_VAR02=$(MySecret02)
      powershell.exe -ExecutionPolicy Bypass -File "C:\temp\my-powershell-script.ps1"
    failOnStdErr: false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions