Skip to content

Azure Dev Tunnels ​

Everyday Open a local port to the internet behind a Microsoft-authenticated URL — for webhooks, client previews, and cross-device testing.

Source of truth ​

Docs: learn.microsoft.com — dev tunnels
CLI reference: cli-commands

Status

Dev tunnels is in public preview — no SLA, and command names/options may still change. Fine for dev and demos, not for production traffic.

Install ​

powershell
# Windows
winget install Microsoft.devtunnel
winget upgrade Microsoft.devtunnel
bash
# macOS
brew install --cask devtunnel
bash
# Linux (and macOS script install)
curl -sL https://aka.ms/DevTunnelCliInstall | bash
bash
devtunnel --version

Log in (required) ​

You cannot host anonymously — the host always authenticates, even if you later allow anonymous clients.

bash
devtunnel user login          # Microsoft / Entra ID account
devtunnel user login -g       # GitHub account
devtunnel user login -d       # device-code flow, no local browser
devtunnel user show

Host a port ​

bash
devtunnel host -p 3000

Prints a public URL like https://TUNNELID-3000.usw2.devtunnels.ms/ plus an inspect URL for the traffic. Ctrl-C stops it — and a temporary tunnel is deleted on exit.

More shapes:

bash
devtunnel host -p 3000 5000              # two ports at once
devtunnel host -p 8443 --protocol https  # local server already speaks HTTPS
devtunnel host -p 8000 --expiration 2d   # 1h … 30d
devtunnel host -p 3000 --allow-anonymous # no login for whoever opens it

Anonymous access

Anyone on the internet who guesses the tunnel ID reaches your local server. Use it only for services that are safe to expose, and keep the expiration short.

Connect from the other side ​

Browser: open the printed URL and sign in with the same account (default is owner-only access).

CLI, to get the port back on localhost:

bash
devtunnel connect TUNNELID
# → Forwarding from 127.0.0.1:3000 to host port 3000

Persistent tunnels ​

A stable ID that survives restarts — useful when a webhook or a client bookmark points at it.

bash
devtunnel create myTunnelID
devtunnel port create -p 3000 --protocol http
devtunnel host                      # hosts the last-used tunnel

devtunnel list
devtunnel show TUNNELID
devtunnel delete TUNNELID

Access control ​

Share without going fully anonymous:

bash
# time-boxed token for one person
devtunnel token TUNNELID --scopes connect

# anonymous, but only for 4 hours
devtunnel access create TUNNELID --anonymous --expiration 4h

# anonymous on one port only
devtunnel access create TUNNELID --port 3000 --anonymous

# whole Entra tenant / a GitHub org
devtunnel access create TUNNELID --tenant
devtunnel access create TUNNELID --org ORG

devtunnel access list TUNNELID
devtunnel access reset TUNNELID

GitHub org access needs the Dev Tunnels GitHub app installed in that org.

Diagnostics ​

bash
devtunnel clusters --ping                  # nearest relay by latency
devtunnel echo http --port 8080            # local test server
devtunnel host -p 8080 --verbose