Skip to main content
VS Code Remote Tunnels provide secure, authenticated access to your development machine from anywhere in the world. You can connect to your remote machine through vscode.dev or the VS Code desktop application without complex SSH or VPN configurations.

Overview

Remote Tunnels use Microsoft Dev Tunnels technology to create a secure connection between your local machine and the VS Code server. This allows you to:
  • Access your development environment from any device with a browser
  • Work on your home/office machine while traveling
  • Collaborate with others by sharing access to your machine
  • Develop on remote machines without SSH port forwarding
  • Use VS Code’s full feature set remotely
Remote Tunnels require authentication with either a Microsoft or GitHub account.

Quick Start

1

Start a tunnel

On your development machine, run:
2

Authenticate

Follow the prompts to log in with your Microsoft or GitHub account. You’ll be given a device code to enter on a web page.
3

Name your machine (optional)

Give your machine a memorable name, or let the CLI generate one randomly:
4

Connect remotely

Open vscode.dev in any browser and connect to your tunnel, or use VS Code desktop with the Remote Tunnels extension.

Creating Tunnels

Basic Tunnel

Start a tunnel with default settings:
This will:
  1. Prompt you to log in (if not already authenticated)
  2. Generate a random machine name (or prompt for one)
  3. Start the tunnel server
  4. Display the URL to access your machine

Named Tunnel

Create a tunnel with a specific name:
Machine names must be unique within your account and can only contain letters, numbers, and hyphens.

Random Name

Generate a random machine name automatically:
Useful for:
  • Temporary development environments
  • CI/CD runners
  • Testing scenarios

Prevent Sleep

Keep your machine awake while the tunnel is running:
This prevents the system from going to sleep, which would disconnect the tunnel.

Accept License Terms

Skip the interactive license acceptance prompt:
Required for:
  • Automated scripts
  • Non-interactive environments
  • CI/CD pipelines

Authentication

Login

Authenticate with the tunnel service:
You’ll be prompted to:
  1. Choose an authentication provider (Microsoft or GitHub)
  2. Visit a URL and enter a device code
  3. Authorize the application
Authenticate using your GitHub account. This is recommended for developers who primarily use GitHub.

Token-Based Authentication

For automated workflows, you can provide access tokens directly:
Or use environment variables:
Never commit access tokens to version control. Use secure secret management for production deployments.

Check Authentication Status

Verify which account is currently logged in:
Output:

Logout

Remove stored credentials:

Managing Tunnels

Check Status

Get information about running tunnels:
Returns JSON output:

Rename Tunnel

Change the name of your machine:
This updates the machine name associated with the port forwarding service.

Restart Tunnel

Restart a running tunnel:
Useful after:
  • Configuration changes
  • Network connectivity issues
  • Extension updates

Stop Tunnel

Stop any running tunnel on the system:
This gracefully shuts down the tunnel server.

Unregister Machine

Remove this machine’s association with the tunnel service:
This removes the machine from your account. You’ll need to create a new tunnel to connect again.

Clean Up Inactive Tunnels

Delete all tunnel servers that are not currently running:
This frees up disk space by removing:
  • Old server installations
  • Unused server data
  • Cached files

Running as a System Service

For always-on tunnel access, install the tunnel as a system service. The service runs in the background and starts automatically on system boot.

Install Service

1

Ensure you're logged in

2

Install the service

Or with a specific name:
3

Accept license terms

Service installation requires administrator/root privileges on most systems.

Platform-Specific Service Management

The CLI creates a systemd service:

View Service Logs

Display logs from the running service:
This shows:
  • Connection events
  • Error messages
  • Performance metrics
  • Authentication status

Uninstall Service

Remove the tunnel service:
This:
  1. Stops the running service
  2. Removes service configuration
  3. Cleans up service files

Advanced Configuration

Custom Server Data Directory

Specify where server data is stored:

Custom Extensions Directory

Use a custom location for extensions:

Pre-install Extensions

Install extensions when the tunnel starts:

Reconnection Grace Time

Set how long the server waits for reconnection (in seconds):
Default is 10800 seconds (3 hours).

Using Existing Tunnels

Connect to an existing tunnel with specific credentials:
These are advanced options primarily for internal or debugging use.

Connecting to Tunnels

Via Browser (vscode.dev)

1

Open vscode.dev

Navigate to https://vscode.dev in any modern browser.
2

Click Remote Tunnels

In the left sidebar, click the Remote Explorer icon or use the Command Palette (F1) and search for “Remote Tunnels”.
3

Sign in

Sign in with the same account you used to create the tunnel.
4

Select your machine

Choose your machine from the list of available tunnels.
5

Start coding

You now have full access to your remote development environment!

Via VS Code Desktop

1

Install Remote Tunnels extension

Install the “Remote - Tunnels” extension from the marketplace.
2

Open Remote Explorer

Click the Remote Explorer icon in the Activity Bar.
3

Connect to tunnel

Select “Remote Tunnels” from the dropdown and click on your machine.

Via VS Code Insiders

VS Code Insiders has built-in tunnel support:

Port Forwarding

The tunnel automatically handles port forwarding for development servers.

How It Works

  1. Start a web server on your remote machine (e.g., localhost:3000)
  2. VS Code detects the server automatically
  3. A forwarded URL is created (e.g., https://abc123.tunnel.dev:3000)
  4. Access your app from anywhere via the forwarded URL

Manual Port Forwarding

You can also manually forward ports:
  1. Open the Command Palette (F1)
  2. Run “Forward a Port”
  3. Enter the port number
  4. Access via the provided URL

Security Considerations

  • All tunnel connections require authentication
  • Only you can access your tunnels (unless explicitly shared)
  • Connections use TLS encryption
  • Tokens are stored securely in the system keychain
  • Tunnels use encrypted WebSocket connections
  • No inbound firewall rules required
  • All traffic goes through Microsoft’s Dev Tunnels service
  • Connection tokens are SHA-256 hashed
  • Your code stays on your machine
  • Only connection metadata passes through the tunnel service
  • You control what is accessible remotely
  • Can be completely unregistered at any time
  • Use strong authentication (GitHub/Microsoft)
  • Don’t share access tokens
  • Regularly rotate credentials
  • Use --no-sleep judiciously (power consumption)
  • Monitor active connections via code tunnel status
  • Unregister unused tunnels

Use Cases

Remote Development

Continuous Development Environment

Collaborative Debugging

CI/CD Integration

Troubleshooting

Common causes:
  • Not authenticated: Run code tunnel user login
  • Port 31545 already in use: Check for existing tunnel processes
  • Network restrictions: Ensure HTTPS/WSS traffic is allowed
Solutions:
Common causes:
  • Tunnel server stopped
  • Different authentication account
  • Network connectivity issues
Solutions:
Common causes:
  • Insufficient permissions
  • Existing service installation
  • System service manager unavailable
Solutions:
Common causes:
  • Machine going to sleep
  • Network instability
  • Firewall blocking connections
Solutions:
Common causes:
  • Extensions not installed on server
  • Extension incompatibility with remote
  • Extension data directory issues
Solutions:

Performance Tips

Network Optimization

  • Use a wired connection when possible
  • Close bandwidth-heavy applications
  • Consider increasing reconnection grace time
  • Enable compression for large file transfers

Resource Management

  • Pre-install frequently used extensions
  • Use custom server data directory on fast storage
  • Regularly prune unused tunnel servers
  • Monitor system resources with code status

Comparison with SSH

Limits and Quotas

Microsoft Dev Tunnels has usage limits for the free tier. See the Dev Tunnels documentation for current limits.
Typical limits:
  • Maximum concurrent tunnels per account
  • Bandwidth limits
  • Connection timeout periods
  • Data transfer quotas

Next Steps

Configuration

Configure tunnels for your workflow

Commands Reference

See all tunnel commands

Installation

Install the CLI

Overview

Back to CLI overview