> ## Content Index
> Fetch the complete content index at: https://www.jonathancreamer.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Using Dev Tunnels to share your local web server
- URL: https://www.jonathancreamer.com/using-dev-tunnels-to-share-your-local-web-server/
- Published: 2026-07-31T14:06:47.000Z
- Updated: 2026-07-31T14:06:47.000Z
- Description: Dev Tunnels can also give you a public HTTPS URL pointing at a port on your laptop in three commands. Perfect for sharing a running webapp with coworkers (or with M365 agents/Copilot connectors) without standing up infra.
- Author: Jonathan Creamer
- Tags: sh, web, Tips, Microsoft

I was recently building a prototype app for some work, and wanted to share it with my team. Usually I would turn to something like ngrok, but I was curious if there was anything new, and anything that was more native to where I work (Microsoft).

Turns out, one of the technologies enabling VSCode Codespaces, Microsoft's [Dev Tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/overview?ref=jonathancreamer.com), was the answer!  
  
Dev Tunnels can also give you a public HTTPS URL pointing at a port on your laptop in three commands. Perfect for sharing a running webapp with coworkers (or with M365 agents/Copilot connectors) without standing up infra.

### **Setup**

On macOS at least... There's other install [instructions](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=macos&ref=jonathancreamer.com) too.

```sh
brew install --cask devtunnel
```

### **Host a local port**

Whichever port you want to host, say a local express, flask, rails app or whatever...

```sh
devtunnel host -p 5050
```

This prints a tunnel ID like \`kind-cat-q7qlggx.use2\` and a URL that proxies to \`localhost:5050\` on your machine.

### **Restrict access to the Microsoft tenant**

This one was a bonus for me! You can also restrict access to it if you're setup with AAD or Entra at your company.  
  
By default the URL is anonymous. To require a Microsoft AAD sign-in (so only people in the tenant can hit it):

```sh
devtunnel access create kind-cat-q7qlggx.use2 --tenant
```

Now anyone hitting the URL has to auth as a Microsoft employee, which is the right default for sharing internal-only tools, demos, or webhooks.

### Why it matters  

- No ngrok account
- No firewall changes
- No temporary App Service.
- Tenant-scoped access means you can safely point AAD-protected services (M365 connectors, Copilot plugins, Teams app manifests) at your laptop while iterating
- Tunnel survives reboots once \`host\` is running; the URL is stable per tunnel ID so you can wire it into a manifest once.

### **Gotchas to remember**

The `host` process has to keep running — when you close the terminal the tunnel goes down. `--tenant` only gates *who can reach the URL*; your app still needs to verify the AAD token itself if you care about identity inside the app.