Azure / Azure/azure-linux-extensions
az ssh vm fails when connecting to a VM in different tenant
- Dominant language
- Python
- Stars
- 333
- Forks
- 278
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
Hi,
We currently operate 2 different AAD tenants (dom1.mycorp.com and dom2.mycorp.com), each with one subscription (sub1 and sub2).
If a user @dom1.mycorp.com tries to connect via AAD SSH to a VM on dom2.mycorp.com, it fails, and the VM displays the following error message at `/var/log/auth`
```
Jan 17 23:24:50 my-vm-name0 aad_certhandler[1367]: Version: 1.0.022030001; user: user1@dom1.mycorp.com
Jan 17 23:24:50 my-vm-name0 aad_certhandler[1367]: This is an Azure machine
Jan 17 23:24:50 my-vm-name0 aad_certhandler[1367]: The tenant id from certificate () does not match the one of the VM ()
Jan 17 23:24:50 my-vm-name0 sshd[1365]: AuthorizedKeysCommand /usr/sbin/aad_certhandler juser1@dom1.mycorp.com xxxxxxxxxxx-some-cert-data---
```
To make this work, we had to do the following
```
az account set --subscription
az ssh vm -g vm_rg-1 -n my-vm-name0
```
However, this is not very interesting as it requires changing a global state on the connecting SSH client.
Any idea if there is any option that would allow this cross-tenant scenario only from CLI params?
Thanks
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the `az ssh vm` entry point and reproduce the failure using the two commands in the issue, first with and then without `az account set`. Compare the CLI behavior with the `/var/log/auth` tenant-mismatch message; done means a cross-tenant connection can be selected through CLI parameters without changing the client's global subscription state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- authentication, cli, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100