2025-08-16
Test Microsoft 365 Apps with Visual Studio Dev Tunnels

You can securely test Microsoft 365 Apps from your local machine by using visual studio dev tunnels. This tool lets you enable dev tunnels for fast, secure, and collaborative testing without needing to deploy to Azure.
| Benefit | Description |
|---|---|
| Accelerated development cycles | Feedback is available within minutes, reducing the time compared to traditional deployment. |
| Evaluation consistency | Ensures the same pipeline is used for both local and production code, minimizing discrepancies. |
| Reduced infrastructure costs | Lowers cloud compute needs during development iterations. |
| Enhanced debugging capabilities | Allows for full local debugging while still utilizing cloud-based evaluation. |
Visual studio dev tunnels offer persistent and named tunnels, Entra ID authentication, robust CLI support, and flexible visibility options. You can choose the right level of access for your project and collaborate with your team in real time.
Key Takeaways
- Visual Studio Dev Tunnels allow you to test Microsoft 365 Apps securely from your local machine without deploying to Azure.
- Local testing helps catch bugs early, saving time and reducing mistakes before sharing apps with users.
- Dev Tunnels provide secure internet access for local services, enabling realistic testing of features like authentication and webhooks.
- You can create and manage tunnels easily with Visual Studio or the command line, allowing for quick setup and collaboration.
- Setting the right tunnel visibility (private, organizational, or public) is crucial for maintaining security during testing.
- Always update your app registration and redirect URIs to match your tunnel URL to avoid authentication errors.
- Use Entra ID authentication to secure your tunnels and ensure only approved users can access your local services.
- Regularly monitor and manage your tunnels to keep your development environment organized and secure.
9 Surprising Facts About Visual Studio Dev Tunnels
- Visual Studio Dev Tunnels give each tunnel a stable, shareable URL or name so you can reuse the same public address across development sessions instead of generating a new one every time.
- Traffic through visual studio dev tunnels is TLS‑encrypted end‑to‑end by default, so you get HTTPS for local servers without managing certificates locally.
- Dev Tunnels support both HTTP(S) and raw TCP port forwarding, letting you expose web apps, APIs, databases, and even SSH over the same tunnel infrastructure.
- You can run multiple named tunnels concurrently and map different local ports to different public endpoints, so multiple teammates can reach distinct services on the same machine.
- Access to tunnels can be restricted with authenticated identities (Microsoft/Azure accounts) and role-based controls, not just with obscure URLs—so sharing can be secure and auditable.
- Visual Studio and Visual Studio Code integrate with dev tunnels, allowing you to create, manage, and connect to tunnels from the IDE without switching tools or copying URLs manually.
- Dev Tunnels are useful for webhook development: external services can call your locally running webhook handler directly using the tunnel URL, eliminating the need for polling or complex NAT config.
- There’s a CLI and programmatic API surface for dev tunnels, enabling automation (CI jobs, ephemeral test environments) that automatically create and tear down tunnel endpoints.
- Because tunnels can be persistent and authenticated, they enable remote debugging scenarios where a teammate or CI agent connects directly to your local service for live diagnostics without VPN or exposing your entire network.
Local Testing with Visual Studio Dev Tunnels
Why Local Testing Matters
You want your Microsoft 365 Apps to work perfectly before sharing them with users. Local testing gives you the power to catch bugs early and see how your code behaves in a safe environment. When you test locally, you can make changes quickly and see results right away. This process saves you time and helps you avoid mistakes that might appear in production.
Traditional localhost testing has limits. Your local machine cannot accept connections from the internet. This makes it hard to test features that need real-world access, such as webhooks, authentication flows, or integration with Microsoft 365 services. You might find yourself stuck, unable to simulate how your app will behave for actual users.
Dev Tunnels has revolutionized the way we develop and test web applications, especially for mobile developers who often face challenges in setting up local servers for testing. It’s a game-changing feature that enhances collaboration and simplifies the development process.
With the right tools, you can overcome these challenges. You can create a realistic environment for your app, even when working from your own computer.
How Dev Tunnels Enable Local Testing
You can test Microsoft 365 Apps from localhost using visual studio dev tunnels. This tool gives you a secure way to expose your local services to the internet. You do not need to deploy your code to Azure or any other cloud platform just to see how it works with Microsoft 365.
Visual Studio Dev Tunnels enhance traditional localhost testing by enabling you to securely expose your local applications to the internet. This capability allows for inbound connections, which is essential for testing Microsoft 365 Apps in a more realistic environment, overcoming the limitations of being confined to local testing.
Here is how dev tunnels improve the speed and security of your local testing:
- Dev tunnels enable local services to act as secure cloud endpoints in under 3 minutes.
- They facilitate secure internet access for local testing of Microsoft 365 Apps.
- Proper configuration is crucial to avoid exposing the development environment.
You can set up tunnels with just a few clicks or commands. You choose the name and visibility of your tunnel, so you control who can access your app. You can use authentication to keep your work safe. This flexibility means you can collaborate with teammates or invite testers without sharing your entire computer.
Dev tunnels let you test features like OAuth authentication, Teams bots, or SharePoint web parts as if they were running in the cloud. You get real-time feedback and can debug issues on the spot. This process makes your development cycle faster and more reliable.
When you use dev tunnels, you build confidence in your code before you deploy. You know your app works in the real world, not just on your machine.
Visual Studio Dev Tunnels Overview
Key Features
Visual studio dev tunnels give you a powerful way to test and debug Microsoft 365 Apps from your local machine. You can expose your asp.net core services to the internet with just a few steps. This tool helps you create a secure and flexible development environment.
Here are some of the main features you will find useful:
- You can expose local APIs using remote URLs, making it easy to test and debug your asp.net core projects.
- Integration with third-party services becomes simple because you have publicly accessible URLs for your local apps.
- You can set breakpoints on your localhost and watch how your asp.net core code responds when remote URLs are accessed.
- Named tunnels help you share specific projects or services without confusion.
- Persistent tunnels let you keep access over time, which is important for ongoing asp.net core projects.
- You can choose access levels for your tunnels: private, organizational, or public. This makes it easy to control who can see your work.
- Entra ID authentication restricts access to users with valid credentials, keeping your data safe.
- The CLI lets you manage and automate tunnel creation and configuration. You can use commands to create, list, and tag tunnels for easier management.
Tip: Persistent and named tunnels help you avoid recreating tunnels every time you restart your asp.net core project. This saves you time and reduces errors.
How Dev Tunnels Work
Dev tunnels create a secure bridge between your local asp.net core server and the internet. You can test Microsoft 365 Apps as if they were running in a live environment.
Secure Public Endpoints
You start by downloading and installing the devtunnel CLI. After logging in with your Entra ID, Microsoft, or GitHub account, you launch your local asp.net core server. Then, you host or create a tunnel using the devtunnel host –p PORT command. If you want a permanent URL, you use the devtunnel create command for a persistent tunnel.
This process gives you a secure, internet-accessible endpoint for your local asp.net core service. You can now test webhooks, authentication flows, and integrations that require public URLs. Entra ID authentication ensures that only approved users can access your tunnels, lowering the risk of accidental data exposure.
Integration with Visual Studio and CLI
Visual studio makes it easy to create and manage dev tunnels. You can set up a tunnel with just a few clicks inside the IDE. The CLI offers even more options, such as fixed-life tunnels and tagging for better organization. You can automate tunnel creation for your asp.net core projects, making your workflow faster and more reliable.
You can also list all your tunnels, view details, and manage access permissions. This flexibility helps you collaborate with your team and keep your development environment secure.
Note: Dev tunnels are designed to securely expose your local asp.net core endpoints to the internet, making testing and debugging safe and efficient.
Host or Create a Tunnel in Visual Studio
Prerequisites and Setup
Before you host or create a tunnel for Microsoft 365 App testing, you need to prepare your environment. Visual studio gives you the tools you need, but you must meet a few requirements first. The following table shows what you need to get started:
| Prerequisite | Description |
|---|---|
| Visual Studio 2022 Preview | Download version 17.6 or later. Make sure the ASP.NET and web development workload is installed. Sign in to use dev tunnels. |
| Power Platform Environment | You need either Power Automate or Power Apps. |
You should check that you have the correct version of visual studio. Open the installer and confirm that the ASP.NET and web development workload is active. Sign in with your Microsoft account to access the dev tunnels tool window. If you plan to connect your asp.net core project to Power Platform, make sure you have access to Power Automate or Power Apps.
Tip: Keeping your tools updated helps you avoid setup issues and ensures you can use the latest features in the dev tunnels tool window.
Creating and Naming a Tunnel
You can create a tunnel directly from the dev tunnels tool window in visual studio. This process lets you expose your asp.net core service to the internet for Microsoft 365 App testing. Follow these steps to create and name your tunnel:
- In the debug dropdown, select Dev Tunnels > Create A Tunnel.
- The dev tunnels tool window opens a dialog. Choose the account you want to use.
- Enter a name for your tunnel. This name helps you identify it in the dev tunnels tool window.
- Pick the tunnel type. Select Persistent if you want the same URL every time, or Temporary for a new URL each session.
- Choose the authentication type: Private, Organization, or Public.
- Click OK to create the tunnel.
When you create a tunnel, you make it easier to connect your asp.net core project to Microsoft 365 services. The dev tunnels tool window keeps your tunnels organized and visible. You can always find your active tunnels and manage them from this window.
Note: Naming your tunnel helps you and your team track which asp.net core service is exposed. Use clear names for each tunnel in the dev tunnels tool window.
Setting Tunnel Visibility
Tunnel visibility controls who can access your dev tunnels. You set this option in the dev tunnels tool window when you create a tunnel. The right visibility level protects your work and supports collaboration.
Here are the main visibility options:
| Visibility Option | Description |
|---|---|
| Private | Only you can access the tunnel. |
| Organization | Anyone in your organization can access the tunnel. For personal accounts, this is the same as Private. |
| Public | Anyone on the internet can access the tunnel. Use this option with caution. |
You can also see these options as:
- Private: Only you can use the tunnel.
- Organization: Your team or company can use the tunnel.
- Public: Anyone can use the tunnel.
The dev tunnels tool window lets you change visibility when you create and manage dev tunnels. Choosing the right visibility helps you monitor traffic and keep your Microsoft 365 App secure. Private tunnels work best for solo development. Organization tunnels help teams test together. Public tunnels allow outside testers but require extra care.
Caution: Public tunnels do not require authentication. Use them only when you need to share your app with users outside your organization and always monitor access in the dev tunnels tool window.
Tunnel visibility affects both security and collaboration. When you set the right level, you make sure only the right people can access your app. This reduces risk and helps your team work together smoothly.
Using the Dev Tunnels CLI
You can manage dev tunnels directly from the command line by using the Dev Tunnels CLI. This tool gives you flexibility and speed, especially when you want to automate your workflow or work outside the visual studio interface. The CLI works well for both quick tests and more advanced setups.
To get started, you need to install the Dev Tunnels CLI. You can do this by running the following command in your terminal:
dotnet tool install -g Microsoft.DevTunnels.Cli
After installation, you must sign in. Use your Microsoft account, Entra ID, or GitHub account. This step connects your CLI session to your visual studio environment and ensures secure access.
devtunnel login
Once you sign in, you can create and manage tunnels. Here is a simple way to create a tunnel for your local project:
devtunnel host -p 5000
This command exposes your local service running on port 5000 to the internet. The CLI will display a public URL that you can use to test your Microsoft 365 App. You can share this URL with your team or use it for integration testing.
If you want a persistent tunnel with a custom name, use:
devtunnel create my-tunnel --persistent
devtunnel host my-tunnel -p 5000
This approach helps you keep the same URL across sessions, which is important for OAuth redirect URIs and consistent testing. You can also set tunnel visibility directly from the CLI. For example, to make your tunnel accessible only to your organization, add the --access organization flag:
devtunnel create my-tunnel --persistent --access organization
Tip: Use clear and descriptive names for your tunnels. This makes it easier to manage multiple projects in visual studio and avoid confusion.
You can list all your active tunnels at any time:
devtunnel list
To stop a tunnel, use:
devtunnel close my-tunnel
The CLI also lets you automate tunnel creation in scripts. This feature is useful when you want to set up dev tunnels as part of your build or deployment process. You can share CLI commands with your team so everyone uses the same configuration, which improves consistency and reduces errors.
Note: The Dev Tunnels CLI works seamlessly with visual studio. You can switch between the CLI and the visual studio interface without losing your tunnel settings.
By mastering the Dev Tunnels CLI, you gain more control over your development environment. You can quickly create, manage, and secure tunnels for any Microsoft 365 App project. This flexibility helps you test and debug your apps efficiently, whether you work alone or as part of a team.
Configure Microsoft 365 Apps for Dev Tunnels

Update App Registration and Redirect URIs
You need to update your app registration and redirect URIs to connect your local asp.net core project to Microsoft 365 services through visual studio. This process helps your app use the secure endpoint provided by dev tunnels. Here is a simple way to set up your app registration:
- Open the Microsoft Entra ID – App Registrations portal.
- Select "New Registration" and enter your app name.
- Choose the supported account types for your app.
- Leave the Redirect URI field empty for now.
- Click "Register" to create your app.
- On the overview page, copy the Application (client) ID and Directory (tenant) ID.
- Under "Manage," select "Expose an API."
- Click the "Set" link to generate the Application ID URI.
- Add a scope named "access_as_user."
- Set "Who can consent?" to "Admins and users."
- Fill in the admin and user consent prompts.
- Make sure the state is set to "Enabled."
- Select "Add scope" to finish.
After you create your tunnel in visual studio, you need to update the Redirect URI in your app registration. Use the public URL from your asp.net core tunnel as the Redirect URI. This step lets Microsoft 365 know where to send authentication responses during testing.
Tip: Always save your client ID and tenant ID. You will need them for authentication and OAuth setup.
Connect Teams, SharePoint, and Power Platform Apps
You can use visual studio to connect your asp.net core services to Teams, SharePoint, and Power Platform Apps. Dev tunnels make this process secure and simple. When you use tunnels, you get alerts if you connect to a tunnel endpoint. These alerts help you avoid phishing attacks and accidental sharing of sensitive URLs.
- Teams bots and message extensions use dev tunnels by default for local development. This setup gives you a secure way to test features before you deploy them.
- SharePoint web parts and Power Platform connectors also benefit from secure endpoints. You can test webhooks, authentication, and data flows in a real-world scenario.
- Microsoft 365 identity authentication adds another layer of security. You must sign in with your Microsoft 365 account to create and manage tunnels in visual studio.
Note: Enhanced security awareness helps you and your team stay safe while testing your asp.net core apps.
Handle Authentication and OAuth
You must configure authentication and OAuth to let your Microsoft 365 Apps work with dev tunnels. Here is a step-by-step guide:
- Register your app in the Microsoft Entra ID portal.
- Set your application URI to match the tunnel endpoint from visual studio.
- Create a client secret for token exchange.
- Add API permissions for Microsoft Graph access.
- Update the Redirect URIs to use your asp.net core tunnel URL.
- Set up dev tunnels for hosting your local service.
- Clone your project repository and update the configuration files with your client ID, tenant ID, and secret.
- Open visual studio and run your asp.net core project.
This setup allows your app to handle sign-in, token exchange, and API calls securely. You can test authentication flows, such as OAuth, in a safe environment before moving to production.
Always double-check your Redirect URIs and permissions. This step prevents common authentication errors and keeps your testing secure.
Security and Best Practices
Tunnel Visibility Options
You control who can access your development environment by setting tunnel visibility. When you create a tunnel, you choose between private, organizational, or public access. Private tunnels allow only you to connect. Organizational tunnels let anyone in your company use the tunnel. Public tunnels open access to anyone with the link. Always pick the lowest visibility needed for your project.
To maximize security during Microsoft 365 App testing, follow these best practices:
- Set tunnels to private or organizational whenever possible.
- Implement split tunneling for Office 365 applications. This method improves performance and keeps your data secure.
- Use Microsoft-provided IP address ranges for split tunneling. Avoid using fully qualified domain names.
- Disable SSL interception for Office 365 traffic. This step helps you comply with Microsoft’s security recommendations.
- Confirm your split tunneling policy works by using the Microsoft 365 connectivity test tool.
- Turn off SSL Break and Inspect for Office 365 domains.
Tip: Review your tunnel visibility settings before sharing any URLs. This habit helps prevent accidental exposure of your development environment.
Secure Access with Entra ID
You can secure your tunnels by requiring authentication with Entra ID. This feature ensures that only approved users can access your local services. When you enable Entra ID authentication, you add a strong layer of protection to your dev tunnels. Only users with valid credentials can connect, which helps keep your data safe.
Entra ID also supports organizational access. You can allow your whole team to test and debug apps without opening your tunnel to the public. This approach balances security and collaboration. Always use Entra ID authentication for sensitive projects or when handling confidential information.
Note: Entra ID authentication works seamlessly with both the Visual Studio interface and the command-line tools.
Monitoring and Managing Tunnels
You need to monitor and manage your tunnels to maintain a secure and efficient workflow. Visual Studio provides built-in features for managing dev tunnels. You can view active tunnels, check their status, and adjust access settings from within the IDE. The command-line interface also lets you create, list, and close tunnels quickly.
Best practices for managing tunnels include:
- Regularly review your list of active tunnels.
- Close tunnels when you finish testing to reduce security risks.
- Use descriptive names for each tunnel to avoid confusion.
- Choose between temporary or permanent tunnels based on your project needs.
- Set access controls to match your security requirements.
A table can help you compare tunnel management options:
| Management Tool | Features |
|---|---|
| Visual Studio IDE | View, create, edit, and close tunnels |
| Command-Line (CLI) | Automate tunnel creation and management |
Remember: Good tunnel management keeps your development environment organized and secure.
Common Pitfalls to Avoid
When you use Visual Studio Dev Tunnels for Microsoft 365 App testing, you want to avoid mistakes that can slow you down or put your project at risk. Many developers run into the same issues. If you know what to watch for, you can save time and keep your environment secure.
1. Choosing the Wrong Tunnel Visibility
You might pick a public tunnel for convenience. This choice can expose your app to anyone with the link. Always check your tunnel’s visibility before you start testing. Use private or organization tunnels for most projects. Only use public tunnels when you need outside testers and always monitor access.
Tip: Review your tunnel settings before sharing URLs with your team or testers.
2. Forgetting to Update Redirect URIs
If you change your tunnel URL, you must update the redirect URIs in your app registration. If you skip this step, authentication will fail. Always double-check that your app registration matches your current tunnel endpoint.
3. Ignoring Authentication Settings
You may forget to enable Entra ID authentication for your tunnel. Without this, anyone can access your local service if they have the link. Always require authentication for sensitive projects. This step protects your data and your users.
4. Leaving Tunnels Open After Testing
If you leave tunnels running after you finish, you increase your security risk. Unused tunnels can become targets for unwanted access. Always close tunnels when you no longer need them.
5. Using Generic or Confusing Tunnel Names
If you use unclear names for your tunnels, you and your team may get confused. Use descriptive names that match your project or service. This habit helps you manage multiple tunnels and avoid mistakes.
6. Overlooking Log Monitoring
You might not check your tunnel logs. Logs help you spot unusual activity or unauthorized access. Make it a habit to review logs regularly.
| Pitfall | How to Avoid It |
|---|---|
| Public tunnel for private app | Set tunnel to private or organization |
| Outdated redirect URI | Update app registration after tunnel changes |
| No authentication | Enable Entra ID authentication |
| Unclosed tunnels | Close tunnels after testing |
| Vague tunnel names | Use clear, descriptive names |
| Ignoring logs | Monitor logs for suspicious activity |
Note: You can prevent most issues by following a checklist before and after each testing session.
By staying alert to these common pitfalls, you keep your development process smooth and your Microsoft 365 Apps secure. You build better habits and help your team avoid unnecessary problems.
Troubleshooting and Advanced Tips
Debugging Connection Issues
You may sometimes face connection problems when working with tunnels. Start by checking if your local service is running and listening on the correct port. Use the command line to confirm that your service responds to requests. If you see errors, restart your service and try again.
Next, check your firewall settings. Firewalls can block incoming connections. Allow traffic on the port you use for your tunnel. If you use a VPN, disconnect it and test again. VPNs can change your network settings and cause issues.
If you still have trouble, use the devtunnel list command to see all active tunnels. Make sure you use the correct tunnel URL in your Microsoft 365 App. Sometimes, copying the wrong URL causes connection failures.
Tip: Always test your tunnel URL in a browser before starting testing and debugging. This step helps you catch simple mistakes early.
Handling Authentication Errors
Authentication errors can stop your app from working with Microsoft 365 services. First, check your app registration in the Microsoft Entra ID portal. Make sure your redirect URIs match the tunnel URL exactly. Even a small typo can cause failures.
Review your client ID and secret. These values must match what you set in your app’s configuration. If you change your tunnel or create a new one, update the redirect URIs in your app registration.
If you see an "unauthorized" message, check your tunnel’s visibility and authentication settings. For sensitive projects, always use Entra ID authentication. This step keeps your data safe and prevents unwanted access.
Note: Most authentication errors come from mismatched URLs or missing permissions. Double-check these settings during debugging.
Advanced CLI and Automation
You can use the Dev Tunnels CLI to automate your workflow. Automation saves time and reduces mistakes. For example, you can write a script to create a tunnel, start your local service, and open the test page in your browser.
Here is a sample script for Windows PowerShell:
devtunnel create my-automation-tunnel --persistent --access organization
devtunnel host my-automation-tunnel -p 5000
Start-Process "https://my-automation-tunnel.devtunnels.ms"
You can share scripts like this with your team. Everyone can use the same setup for testing and debugging. This approach helps you work together and avoid configuration errors.
If you want to close all tunnels at once, use:
devtunnel close --all
Automating tunnel management makes your development process smoother and more reliable. Try using scripts for repeated tasks.
You can boost your Microsoft 365 App development by using visual studio dev tunnels. This tool makes testing faster and more secure. Start by setting up your first tunnel and follow best practices for visibility and authentication. Explore advanced features to improve your workflow. Remember to focus on security and teamwork as you continue testing and building better apps.
Visual Studio Dev Tunnels Checklist
Quick checklist to configure, use, and troubleshoot Visual Studio Dev Tunnels.
- Verify Visual Studio version supports Visual Studio Dev Tunnels (Visual Studio 2022 or later / required workload installed)
- Install or update the dev tunnels extension or CLI component if required
- Sign in to your Microsoft account or AAD tenant used for tunnel access
- Create a new dev tunnel from Visual Studio or via the dev tunnels CLI
- Choose and confirm the correct tunnel name and region for low latency
- Select and configure the local endpoint (port) to expose through the tunnel
- Confirm protocol (HTTP/HTTPS or TCP) and enable TLS if exposing HTTPS
- Configure and reserve custom domains or subdomains if needed
- Set access policies: public, authenticated users, or specific AAD users/groups
- Validate firewall and router settings to allow outbound tunnel traffic
- Verify local app is running and listening on the configured port
- Test tunnel connectivity from an external device or collaborator
- Use HTTPS and valid certificates for production-sensitive endpoints
- Rotate credentials and tokens periodically; revoke unused tokens
- Monitor active tunnel sessions and usage from the Visual Studio or portal dashboard
- Limit exposed routes and only forward necessary endpoints
- Enable logging and inspect tunnel logs for connection errors or performance issues
- Troubleshoot common issues: port conflicts, authentication failures, region mismatch
- Update Visual Studio and dev tunnel tooling regularly for security fixes
- Close or delete inactive tunnels to reduce attack surface and resource usage
dev tunnels in visual studio — use dev tunnels for asp.net core web projects
What are Visual Studio Dev Tunnels and how do they work?
Visual Studio Dev Tunnels is a feature (introduced and improved in Visual Studio 2022 v17.6 and later) that lets you create a secure tunnel from a local web project or local web service to the internet so remote machines, collaborators, CI systems, or mobile applications can access your web app or API. It creates a public dev tunnel URL that forwards requests to your localhost, enabling connections between machines that can't otherwise reach your development machine.
How do I create and use dev tunnels in Visual Studio?
In Visual Studio (VS 2022) you can open the Dev Tunnels window (via View > Other Windows > Dev Tunnels or the debug dropdown) and choose to create a tunnel for your web app or api. You pick a tunnel type (persistent or temporary), expose the local port for your ASP.NET Core web or core web API, and Visual Studio will generate a dev tunnel url. Use that URL in a web browser, mobile app, or webhook consumer to test your web services from remote environments.
What’s the difference between persistent and temporary tunnels?
Persistent tunnels remain registered (and can have stable dev tunnel URL mapping) across Visual Studio sessions and are useful for long-lived testing or collaboration; temporary tunnels are ad-hoc and exist only while your Visual Studio session or the tunnel process runs. Temporary tunnels are great for quick demos, testing and development, or when you don’t want to maintain a permanent public endpoint.
Can I use Dev Tunnels to test webhooks and web APIs from external services?
Yes — dev tunnels expose your local web API or web application to the internet so external services (payment providers, webhook senders, or Microsoft Learn labs) can reach your local endpoint. This is similar to ngrok but integrated into Visual Studio, providing a seamless debugging experience with breakpoints and local development environment tooling.
Do I need ngrok if I use Visual Studio Dev Tunnels?
No, ngrok is an alternative. Visual Studio’s dev tunnels feature offers a built-in option to create tunnels in Visual Studio 2022 without installing third-party tools. Some teams may still prefer ngrok for specific workflows, automation, or advanced features, but for many local development scenarios VS dev tunnels are sufficient.
How secure are dev tunnel URLs and connections?
Dev tunnels use authenticated, encrypted connections and are designed for development and testing. Persistent tunnels can be scoped to Visual Studio accounts or team identities to control access. Still, treat any public URL as potentially accessible and do not expose sensitive production data via a dev tunnel.
Can I debug an ASP.NET Core web API while it’s exposed through a dev tunnel?
Yes — you can debug an asp.net core web project that’s exposed through a dev tunnel just like a local web project. Requests arriving via the dev tunnel URL are forwarded to your local host where Visual Studio attaches the debugger, enabling breakpoints, step-through, and the standard debugging experience for web apis and core web applications.
How do dev tunnels help mobile developers and mobile app testing?
Mobile developers often need their mobile app to communicate with a local backend. Dev tunnels enable ad-hoc connections between machines so a phone or emulator on a different network can reach your local web services. This removes the need to deploy to cloud or change DNS settings and speeds up the development workflow for mobile applications.
What use cases are best suited for Visual Studio Dev Tunnels?
Common use cases include testing webhooks, collaborating with remote team members, demoing a feature to a stakeholder, connecting CI systems to local services, mobile app integration testing, and validating web APIs from external systems. They are particularly useful when you need to test local web services that otherwise cannot be reached from the internet.
How do I open the dev tunnels window and manage tunnels in VS?
Open the Dev Tunnels window from View > Other Windows > Dev Tunnels or from the debug dropdown in Visual Studio 2022. From there you can create new tunnels, pick a tunnel type (temporary tunnels or persistent), view the dev tunnel url, and stop or remove tunnels. The UI integrates with your development process so you can switch between running and exposing local web projects quickly.
Will the dev tunnel URL change each time Visual Studio creates a temporary tunnel?
Temporary tunnels usually generate a new dev tunnel url each time you create them. Persistent tunnels are intended to give a more stable URL across sessions. If you need a stable URL for integration testing or webhooks, choose a persistent tunnel or manage DNS/redirects outside the tunnel for production-like flows.
Can I use dev tunnels with Dataverse or other Microsoft cloud services?
Yes — dev tunnels can make your local endpoints reachable to cloud services that need callbacks or integrations, including Dataverse connectors and Microsoft-hosted services. Ensure authentication and security are configured properly; use tunnels for development/testing rather than production integrations unless explicitly supported.
How do dev tunnels compare with deploying to Azure for testing?
Dev tunnels let you test locally without deploying, which dramatically speeds up iterations and debugging. Deploying to Azure replicates production environments but adds deployment time and may complicate debugging. Use dev tunnels for development workflow speed and local debugging, and deploy to Azure for staging/production validation and performance testing.
Can I automate creating tunnels from my development process or CI?
Visual Studio’s UI is the most direct route, but the dev tunnels service provides CLI and APIs that can be scripted to create tunnels programmatically. This lets you automate tunnel creation for test runs, demos, or integration tests where an ephemeral dev tunnel url is required by external systems.
Are there limits to the kinds of local web services I can expose?
You can expose most local web services, including asp.net core web apps, web apis, core web services, and local web projects built with other frameworks. Some limitations may apply for protocols or ports not supported by the dev tunnels service; check Visual Studio documentation (and Microsoft Learn) for current platform specifics.
How does the debugging experience change when using a dev tunnel URL in a web browser?
The debugging experience remains seamless: requests from a web browser to the dev tunnel url are forwarded to your local host and handled by Visual Studio’s debugger. You can set breakpoints in your web project, inspect requests, and iterate code while the remote client interacts via the tunnel.
Can I expose multiple web apis or services at once with Dev Tunnels?
Yes, you can create multiple tunnels or configure a single tunnel to forward multiple ports depending on your scenario. This helps when testing a suite of local web services or microservices simultaneously from remote clients or mobile applications.
Is Visual Studio Dev Tunnels available in older VS versions like VS 2019?
The integrated Dev Tunnels feature is specific to Visual Studio 2022 (notably v17.6 and newer) and later versions. For older Visual Studio versions you’d use external tunneling tools (like ngrok) or upgrade to a supported VS release to use the built-in experience.
Where can I find tutorials or official guidance to get started?
Microsoft Learn and the Visual Studio documentation contain step-by-step tutorials on how to open the dev tunnels window, create tunnels, and use dev tunnels in Visual Studio for local development and testing. Search “Visual Studio Dev Tunnels tutorial” or consult the “create and use dev tunnels” guides on Microsoft Learn for hands-on examples.
Apple Podcasts · Spotify · YouTube
Host: Mirko Peters