Azure / Azure/azure-cli

Docker image: SSH command is gone

Open
#27,841 7 comments 0 reactions 1 assignee Claimed by @jiasli View on GitHub
Account act-identity-squad act-observability-squad Auto-Assign Auto-Resolve bug customer-reported Possible-Solution question Service Attention Similar-Issue SSH VM SSH
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Former versions of the "standard" docker image (mcr.microsoft.com/azure-cli:latest) contained ssh command (formerly provided by installed openssh package).

This is no longer the case for version 2.54.0 build at 2023-11-08T05:17:55Z.
```
C:\Users\inno-steffg>docker run --rm -it mcr.microsoft.com/azure-cli:2.53.1
076587dd38b9:/# ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user@]host[:port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] destination [command [argument ...]]
```
```
C:\Users\inno-steffg>docker run --rm -it mcr.microsoft.com/azure-cli:2.54.0
8f4637cae6e2:/# ssh
bash: ssh: command not found
8f4637cae6e2:/# find -name "ssh"
./usr/share/bash-completion/completions/ssh
```

Having the ssh command within the container allowed to forward ports using a combination of Azure bastion and Azure virtual linux machine.

From the [Azure CLI documentation][1], which shows how to map local SSH keys into the container, I concluded, that ssh is a part of the image.

[1]: https://learn.microsoft.com/en-us/cli/azure/run-azure-cli-docker

### Related command

`docker run --rm -it mcr.microsoft.com/azure-cli sh -c "az extension add -n ssh && az login --use-device-code && az ssh vm --ip azureVm"`

### Errors

```
Failed to run ssh command with error: [Errno 2] No such file or directory: 'ssh'.
Ensure OpenSSH is installed correctly.
Alternatively, use --ssh-client-folder to provide OpenSSH folder path.
```

### Issue script & Debug output

-

### Expected behavior

SSH console opens

### Environment Summary

azure-cli 2.54.0

core 2.54.0
telemetry 1.1.0

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location '/usr/local/bin/python'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.11.6 (main, Oct 19 2023, 05:43:48) [GCC 12.2.1 20220924]

Legal docs and information: aka.ms/AzureCliLegal

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.