Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using IAP Desktop to create the tunnel for VSCode Remote development #1247

Open
KingBain opened this issue Jan 18, 2024 · 1 comment
Open

Comments

@KingBain
Copy link

KingBain commented Jan 18, 2024

Has anyone been able to successfully create this configuration?

Using IAP Desktop to create the tunnel for VSCode Remote development.

Ideal situation is use IAP Desktop handle auth and tunnel creation to VM via SSH

Use VSCode plus remote development extension to connect via tunnel to SSH session.

@jpassing
Copy link
Collaborator

What should work is the following:

  1. In IAP Desktop, right-click the target VM and selecting Connect client application > Forward local port.
  2. In the Forward local port dialog, enter port number 22 and click OK.
    After a few seconds, you see a notification containing the local port number of the tunnel.

This gives you a tunnel through which you can use SSH. But for VS Code to work, you also need an SSH key.

If you request IAP Desktop to create a tunnel, it doesn't create/publish an SSH key -- and even if it did, VS Code wouldn't be able to access the private key because IAP Desktop stores the private key in the Windows CNG key store while VS Code/OpenSSH expects it as a file on disk.

So you need to create and publish the key yourself (manually or by using gcloud) and save the key in the default .ssh folder where VS Code can find it. Once the key is in place, you should be able to create an SSH connection to localhost:<port-number-of-tunnel> from within VS Code.

I agree that it's all not particularly convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants