Azure / Azure/azure-cli-extensions
error using az ssh to linux VM using AADSSHforLinux
- Dominant language
- Python
- Stars
- 454
- Forks
- 1.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 64
Description
### **This is autogenerated. Please review and update as needed.**
## Describe the bug
**Command Name**
`az ssh config
Extension Name: ssh. Version: 0.1.8.`
**Errors:**
```
The command failed with an unexpected error. Here is the traceback:
[Errno 2] No such file or directory: '/home/nclo_azu_a_t1351gw/.ssh/config'
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.6/site-packages/azure-cli-extensions/ssh/azext_ssh/custom.py", line 29, in ssh_config
_do_ssh_op(cmd, resource_group_name, vm_name, ssh_ip, public_key_file, private_key_file, use_private_ip, op_call)
File "/opt/az/lib/python3.6/site-packages/azure-cli-extensions/ssh/azext_ssh/custom.py", line 50, in _do_ssh_op
op_call(ssh_ip, username, cert_file, private_key_file)
File "/opt/az/lib/python3.6/site-packages/azure-cli-extensions/ssh/azext_ssh/ssh_utils.py", line 81, in write_ssh_config
with open(config_path, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/nclo_azu_a_t1351gw/.ssh/config'
```
## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- `az login`
- `az ssh config --file {~/.ssh/config} -n {MyVM01} -g {my-testrg} --prefer-private-ip`
## Expected Behavior
- output the openssh config that can be used to connect to the VM
## Environment Summary
```
Linux-5.4.0-1062-azure-x86_64-with-debian-10.2 (Cloud Shell), Common Base Linux Delridge (quinault)
Python 3.6.10
Installer: DEB
azure-cli 2.30.0
Extensions:
ai-examples 0.2.5
ssh 0.1.8
```
## Additional Context
- Following the instruction outlined here https://docs.microsoft.com/en-us/azure/active-directory/devices/howto-vm-sign-in-azure-ad-linux#exporting-ssh-configuration-for-use-with-ssh-clients-that-support-openssh
- using the additional flag "--prefer-private-ip" because the VM cannot have a public IP
Contributor guide
Assessment
This issue has not been assessed yet.