Skip to content

Azure Jenkins agent plugin does not work with custom SSH (not provided by Azure agent plugin) #670

@pradeepbagul

Description

@pradeepbagul

Jenkins and plugins versions report

Jenkins: 2.492.1
OS: Linux - 4.18.0-553.30.1.el8_10.x86_64
Java: 17.0.14 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
Parameterized-Remote-Trigger:3.2.1
analysis-model-api:13.2.0
ant:513.vde9e7b_a_0da_0f
antisamy-markup-formatter:173.v680e3a_b_69ff3
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
apache-httpcomponents-client-5-api:5.5-150.veb_76e719855b_
artifactory:4.0.8
asm-api:9.8-135.vb_2239d08ee90
audit-trail:395.vce180b_359a_b_5
authentication-tokens:1.131.v7199556c3004
authorize-project:2.0.0
aws-credentials:245.v8a_1b_7c11a_94d
aws-java-sdk-ec2:1.12.780-480.v4a_0819121a_9e
aws-java-sdk-minimal:1.12.780-480.v4a_0819121a_9e
aws-java-sdk2-core:2.31.45-42.va_ffb_565de208
aws-java-sdk2-ec2:2.31.45-42.va_ffb_565de208
azure-credentials:357.v6447d38fb_007
azure-sdk:211.vd3b_6c5504331
azure-vm-agents:1026.v6b_6edb_b_e3fff
blueocean:1.27.19
blueocean-bitbucket-pipeline:1.27.19
blueocean-commons:1.27.19
blueocean-config:1.27.19
blueocean-core-js:1.27.19
blueocean-dashboard:1.27.19
blueocean-display-url:2.4.4
blueocean-events:1.27.19
blueocean-git-pipeline:1.27.19
blueocean-github-pipeline:1.27.19
blueocean-i18n:1.27.19
blueocean-jwt:1.27.19
blueocean-personalization:1.27.19
blueocean-pipeline-api-impl:1.27.19
blueocean-pipeline-editor:1.27.19
blueocean-pipeline-scm-api:1.27.19
blueocean-rest:1.27.19
blueocean-rest-impl:1.27.19
blueocean-web:1.27.19
bootstrap5-api:5.3.3-2
bouncycastle-api:2.30.1.80-261.v00c0e2618ec3
branch-api:2.1217.v43d8b_b_d8b_2c7
build-name-setter:2.5.0
build-timeout:1.38
caffeine-api:3.2.0-166.v72a_6d74b_870f
checks-api:370.vb_61a_c57328f3
cloud-stats:377.vd8a_6c953e98e
cloudbees-bitbucket-branch-source:936.3.0
cloudbees-folder:6.1012.v79a_86a_1ea_c1f
command-launcher:123.v37cfdc92ef67
commons-compress-api:1.27.1-3
commons-lang3-api:3.17.0-87.v5cf526e63b_8b_
commons-text-api:1.13.1-176.v74d88f22034b_
config-file-provider:988.v0461fcc2b_9d1
configuration-as-code:1963.v24e046127a_3f
coverage:2.6.0
credentials:1415.v831096eb_5534
credentials-binding:687.v619cb_15e923f
data-tables-api:2.2.2-1
dependency-check-jenkins-plugin:5.6.1
display-url-api:2.209.v582ed814ff2f
docker-commons:451.vd12c371eeeb_3
docker-workflow:611.v16e84da_6d3ff
dtkit-api:3.0.3
durable-task:587.v84b_877235b_45
echarts-api:5.6.0-4
eddsa-api:0.3.0.1-19.vc432d923e5ee
email-ext:1876.v28d8d38315b_d
envinject:2.926.v69c9b_3896a_96
envinject-api:1.235.va_14c74f8f487
external-monitor-job:223.vb_fddcf42c9b_3
favorite:2.235.v4d873c7d02e9
font-awesome-api:6.7.2-1
forensics-api:3.1.0
git:5.7.0
git-changelog:3.45
git-client:6.1.3
git-server:137.ve0060b_432302
github:1.43.0
github-api:1.321-488.v9b_c0da_9533f8
github-branch-source:1815.v9152b_2ff7a_1b_
gitlab-api:5.6.0-100.v83f8f4b_f1129
gitlab-branch-source:718.v40b_5f0e67cd3
gitlab-plugin:1.9.8
gradle:2.15
gson-api:2.13.1-139.v4569c2ef303f
handy-uri-templates-2-api:2.1.8-36.v85e4cb_234a_13
hashicorp-vault-plugin:371.v884a_4dd60fb_6
htmlpublisher:425
http_request:1.20
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:88.va_4187cb_eddf1
jackson2-api:2.19.0-404.vb_b_0fd2fea_e10
jakarta-activation-api:2.1.3-2
jakarta-mail-api:2.1.3-2
javadoc:327.vdfe586651ee0
javax-activation-api:1.2.0-8
javax-mail-api:1.6.2-11
jaxb:2.3.9-133.vb_ec76a_73f706
jdk-tool:83.v417146707a_3d
jenkins-design-language:1.27.19
jersey2-api:2.45-154.v4ded3dc34f81
jira:3.16
jjwt-api:0.11.5-120.v0268cf544b_89
job-dsl:1.92
jobConfigHistory:1305.vf20a_356586b_8
joda-time-api:2.14.0-127.v7d9da_295a_d51
jquery:1.12.4-3
jquery3-api:3.7.1-3
jsch:0.2.16-95.v3eecb_55fa_b_78
json-api:20250517-153.vc8a_a_d87c0ce3
json-path-api:2.9.0-148.v22a_7ffe323ce
jsoup:1.20.1-46.ve5f1416988c2
junit:1335.v6b_a_a_e18534e1
ldap:780.vcb_33c9a_e4332
lockable-resources:1349.v8b_ccb_c5487f7
mailer:489.vd4b_25144138f
mapdb-api:1.0.9-44.va_1e1310c9118
matrix-project:849.v0cd64ed7e531
maven-plugin:3.26
metrics:4.2.30-471.v55fa_495f2b_f5
mina-sshd-api-common:2.15.0-161.vb_200831a_c15b_
mina-sshd-api-core:2.15.0-161.vb_200831a_c15b_
nunit:571.v30a_1e3f86709
okhttp-api:4.11.0-189.v976fa_d3379d6
oss-symbols-api:324.v432cce4172ca_
pam-auth:1.12
pipeline-build-step:567.vea_ce550ece97
pipeline-github-lib:65.v203688e7727e
pipeline-graph-analysis:237.v2b_75640ca_888
pipeline-graph-view:538.v647ee88449dd
pipeline-groovy-lib:752.vdddedf804e72
pipeline-input-step:517.vf8e782ee645c
pipeline-milestone-step:138.v78ca_76831a_43
pipeline-model-api:2.2255.v56a_15e805f12
pipeline-model-definition:2.2255.v56a_15e805f12
pipeline-model-extensions:2.2255.v56a_15e805f12
pipeline-rest-api:2.38
pipeline-stage-step:322.vecffa_99f371c
pipeline-stage-tags-metadata:2.2255.v56a_15e805f12
pipeline-stage-view:2.38
pipeline-utility-steps:2.19.0
plain-credentials:195.vb_906e9073dee
plugin-util-api:6.1.0
prism-api:1.30.0-1
pubsub-light:1.19
rebuild:338.va_0a_b_50e29397
resource-disposer:0.25
role-strategy:771.v3fa_85a_df2c50
scm-api:704.v3ce5c542825a_
script-security:1373.vb_b_4a_a_c26fa_00
slack:761.v2a_8770f0d169
snakeyaml-api:2.3-125.v4d77857a_b_402
sse-gateway:1.28
ssh-credentials:355.v9b_e5b_cde5003
ssh-slaves:3.1031.v72c6b_883b_869
sshd:3.353.v2b_d33c46e970
structs:343.vdcf37b_a_c81d5
timestamper:1.29
token-macro:444.v52de7e9c573d
trilead-api:2.209.v0e69b_c43c245
variant:70.va_d9f17f859e0
versioncolumn:320.v6b_b_814ca_01f7
warnings-ng:12.6.0
workflow-aggregator:608.v67378e9d3db_1
workflow-api:1373.v7b_813f10efa_b_
workflow-basic-steps:1079.vce64b_a_929c5a_
workflow-cps:4106.v7a_8a_8176d450
workflow-durable-task-step:1405.v1fcd4a_d00096
workflow-job:1520.v56d65e3b_4566
workflow-multibranch:806.vb_b_688f609ee9
workflow-scm-step:437.v05a_f66b_e5ef8
workflow-step-api:700.v6e45cb_a_5a_a_21
workflow-support:968.v8f17397e87b_8
ws-cleanup:0.48

What Operating System are you using (both controller, and any agents involved in the problem)?

We are using Windows Server 2022 as OS and controller version - Jenkins 2.492.1

Reproduction steps

Step 1 - Created an image snapshot of a running VM in Azure and store it in an Azure gallery
Step 2 - Setup Jenkins Cloud template, pointing to our Image in our Jenkins Gallery within Azure

Note - we do not want to use the SSH provided by the Azure agent plugin, hence we are disabling "Pre-Install SSH in Windows Agent
from the template".

I've attached the log file for you to look over.

Expected Results

The Azure Agent plugin should work with custom SSH. (not provided by Azure agent plugin)

Actual Results

Jenkins' job failed with below error:
java.io.IOException: inputstream is closed

Anything else?

Got remote session for user abcd to host xx.xxx.xx.xx:22
May 26, 2025 10:42:05 AM INFO com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher executeRemoteCommand
Starting java -fullversion
May 26, 2025 10:42:13 AM SEVERE com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher copyFileToRemote
Error occurred while copying file to remote host
java.io.IOException: inputstream is closed
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2867)
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2893)
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.start(ChannelSftp.java:243)
Caused: com.jcraft.jsch.JSchException
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.start(ChannelSftp.java:291)
	at PluginClassLoader for jsch//com.jcraft.jsch.Channel.connect(Channel.java:162)
	at PluginClassLoader for jsch//com.jcraft.jsch.Channel.connect(Channel.java:155)
	at PluginClassLoader for azure-vm-agents//com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher.copyFileToRemote(AzureVMAgentSSHLauncher.java:328)
	at PluginClassLoader for azure-vm-agents//com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher.launch(AzureVMAgentSSHLauncher.java:226)
	at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:297)
	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

May 26, 2025 10:42:13 AM SEVERE com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher launch
Got exception on agent packerwiec33f0
java.io.IOException: inputstream is closed
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2867)
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2893)
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.start(ChannelSftp.java:243)
Caused: com.jcraft.jsch.JSchException
	at PluginClassLoader for jsch//com.jcraft.jsch.ChannelSftp.start(ChannelSftp.java:291)
	at PluginClassLoader for jsch//com.jcraft.jsch.Channel.connect(Channel.java:162)
	at PluginClassLoader for jsch//com.jcraft.jsch.Channel.connect(Channel.java:155)
	at PluginClassLoader for azure-vm-agents//com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher.copyFileToRemote(AzureVMAgentSSHLauncher.java:328)
	at PluginClassLoader for azure-vm-agents//com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher.launch(AzureVMAgentSSHLauncher.java:226)
	at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:297)
	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Are you interested in contributing a fix?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions