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
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.
Name your machine (optional)
Give your machine a memorable name, or let the CLI generate one randomly:
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:- Prompt you to log in (if not already authenticated)
- Generate a random machine name (or prompt for one)
- Start the tunnel server
- 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:- Temporary development environments
- CI/CD runners
- Testing scenarios
Prevent Sleep
Keep your machine awake while the tunnel is running:Accept License Terms
Skip the interactive license acceptance prompt:- Automated scripts
- Non-interactive environments
- CI/CD pipelines
Authentication
Login
Authenticate with the tunnel service:- Choose an authentication provider (Microsoft or GitHub)
- Visit a URL and enter a device code
- Authorize the application
- GitHub
- Microsoft
Token-Based Authentication
For automated workflows, you can provide access tokens directly:Check Authentication Status
Verify which account is currently logged in:Logout
Remove stored credentials:Managing Tunnels
Check Status
Get information about running tunnels:Rename Tunnel
Change the name of your machine:Restart Tunnel
Restart a running tunnel:- Configuration changes
- Network connectivity issues
- Extension updates
Stop Tunnel
Stop any running tunnel on the system:Unregister Machine
Remove this machine’s association with the tunnel service:Clean Up Inactive Tunnels
Delete all tunnel servers that are not currently running:- 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
Service installation requires administrator/root privileges on most systems.
Platform-Specific Service Management
- Linux (systemd)
- macOS (launchd)
- Windows
The CLI creates a systemd service:
View Service Logs
Display logs from the running service:- Connection events
- Error messages
- Performance metrics
- Authentication status
Uninstall Service
Remove the tunnel service:- Stops the running service
- Removes service configuration
- 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):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)
Open vscode.dev
Navigate to https://vscode.dev in any modern browser.
Click Remote Tunnels
In the left sidebar, click the Remote Explorer icon or use the Command Palette (
F1) and search for “Remote Tunnels”.Via VS Code Desktop
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
- Start a web server on your remote machine (e.g.,
localhost:3000) - VS Code detects the server automatically
- A forwarded URL is created (e.g.,
https://abc123.tunnel.dev:3000) - Access your app from anywhere via the forwarded URL
Manual Port Forwarding
You can also manually forward ports:- Open the Command Palette (
F1) - Run “Forward a Port”
- Enter the port number
- Access via the provided URL
Security Considerations
Authentication & Authorization
Authentication & Authorization
Network Security
Network Security
- 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
Data Privacy
Data Privacy
- 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
Best Practices
Best Practices
- Use strong authentication (GitHub/Microsoft)
- Don’t share access tokens
- Regularly rotate credentials
- Use
--no-sleepjudiciously (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
Tunnel won't start
Tunnel won't start
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
Can't connect to tunnel
Can't connect to tunnel
Common causes:
- Tunnel server stopped
- Different authentication account
- Network connectivity issues
Service won't install
Service won't install
Common causes:
- Insufficient permissions
- Existing service installation
- System service manager unavailable
Tunnel keeps disconnecting
Tunnel keeps disconnecting
Common causes:
- Machine going to sleep
- Network instability
- Firewall blocking connections
Extensions not working
Extensions not working
Common causes:
- Extensions not installed on server
- Extension incompatibility with remote
- Extension data directory issues
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
| Feature | Tunnels | SSH |
|---|---|---|
| Setup complexity | Simple | Moderate |
| Firewall config | Not required | Required |
| Web browser access | ✅ Yes | ❌ No |
| Built-in auth | ✅ Yes | Manual |
| Port forwarding | Automatic | Manual |
| Cross-platform | ✅ Yes | ✅ Yes |
| Always-on service | ✅ Yes | Requires setup |
| Free tier | ✅ Yes | N/A |
Limits and Quotas
Microsoft Dev Tunnels has usage limits for the free tier. See the Dev Tunnels documentation for current 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