Azure / Azure/azure-cli-extensions

az ssh vm does not work on private VM

Open
#2,762 4 comments 0 reactions 1 assignee Assigned to @jiasli View on GitHub
Compute feature-request question VM SSH
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
I was trying to access a Bastion Host, wich has no public IP address.

**Command Name**
`az ssh vm
Extension Name: ssh. Version: 0.1.0.`

**Errors:**
```
'NoneType' object has no attribute 'id'
Traceback (most recent call last):
python3.8/site-packages/knack/cli.py, ln 215, in invoke
cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 654, in execute
raise ex
cli/core/commands/__init__.py, ln 717, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 710, in _run_job
six.reraise(*sys.exc_info())
...
cliextensions/ssh/azext_ssh/custom.py, ln 19, in ssh_vm
_do_ssh_op(cmd, resource_group_name, vm_name, ssh_ip,
cliextensions/ssh/azext_ssh/custom.py, ln 32, in _do_ssh_op
ssh_ip = ssh_ip or ip_utils.get_ssh_ip(cmd, resource_group, vm_name)
cliextensions/ssh/azext_ssh/ip_utils.py, ln 27, in get_ssh_ip
parsed_ip_id = tools.parse_resource_id(public_ip_ref.id)
AttributeError: 'NoneType' object has no attribute 'id'
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- `az ssh vm --resource-group {} --vm-name {}`

## Expected Behavior
Successful SSH connection and login.

## Environment Summary
```
macOS-10.15.7-x86_64-i386-64bit
Python 3.8.6
Installer: HOMEBREW

azure-cli 2.15.1

Extensions:
ssh 0.1.0

```
## Additional Context

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.