type
status
date
summary
tags
category
URL
password
slug
icon
In this article
Dev tunnels is a powerful tool to securely open your localhost to the internet and control who has access, so you can easily test and debug your web apps and webhooks from virtually anywhere. Create, host, and connect to your first dev tunnel in seconds.
In this quickstart, you'll learn how to create, host, and connect to your first dev tunnel in seconds.
Install
Before you create a dev tunnel, you first need to download and install the
devtunnel
CLI (Command Line Interface) tool that corresponds to your operating system.Windows Package Manager (winget)
You can use winget, Microsoft's package manager for Windows, to install and update the
devtunnel
CLI.This command installs the latest version by default and removes the older version in the same location, which is %LOCALAPPDATA%\Microsoft\WinGet\Packages. To specify a version, add
--version <version_number>
with your desired version to the command.PowerShell script
You can also install the
devtunnel
CLI using PowerShell and running the following command:Direct download link:
Run commands with
devtunnel
instead of ./devtunnel
:- Press the Windows key and type 'Environment variables'.
- Select the option 'Edit the system environment variables'.
- Select the 'Environment Variables...' button.
- There you see two tables, in the 'System Variables' table, find and select the 'PATH' variable.
- Select the 'Edit...' button.
- A window should pop up. Select the 'New' button.
- Type the directory path of your devtunnel.exe file (directory means exclude the file name from path.
- To find the directory string, you can navigate to the directory in PowerShell or terminal and type 'pwd')
- Select 'Ok' on all open windows and restart the command prompt.
Homebrew
You can use Homebrew, to install and update the
devtunnel
CLI. The following commands could be used with or without --cask
.Please note, the following command is only available if you installed the version you are looking for with Homebrew previously. To see a list of which versions you have available, run the command above.
Script
Direct download link:
Direct download link:
Login
To start a dev tunnel, you first need to log in with either a Microsoft Entra ID, Microsoft, or GitHub account. Dev tunnels doesn't support hosting tunnels anonymously for more information take a look at the CLI command reference documentation.
Host
Once logged in you can start hosting a dev tunnel using the
host
command. In the example below dev tunnels will:- Run a local server on port
8080
that echoes requests sent to it.
- Host a dev tunnel for the local port
8080
that is accessible to the internet.
A successful
host
command prints something similar to the following example to the console.The printed text contains:
tunnel_id
- The ID of the dev tunnel.
- Public URL - The URL, which can be used to access your dev tunnel,
https://<tunnel_id>.usw2.devtunnels.ms:8080/
in this example.
- Inspect URL - The URL you can use to inspect the traffic sent across the dev tunnel in,
https:/<tunnel_id>-8080-inspect.usw2.devtunnels.ms/
in this example.
Connect
To connect to the dev tunnel, you need to:
- Visit this URL in a web browser.
- Login using the same account as you used to host the dev tunnel. By default, dev tunnels are only accessible to you.
Congratulations! You can now access your local service across the internet.
Next Steps
上一篇
一次服务器被入侵的处理过程分享 - 自由早晚乱余生 - 博客园
下一篇
Automated Alerts on Azure (Entra ID) Application Secret Expirations - The Lazy Administrator
- Author:NetSec
- URL:https://blog.51sec.org/article/872b08f6-7143-49a8-a275-0d1f03697046
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!