Blogs from our authors

Office 365: The best recipes for developers
Gustavo Velez
Learn more and buy
Return to Blogs
Ngrok can help you when developing software for Microsoft Office 365Gustavo Velez
Sometimes, when developing new software for Microsoft Office 365, you need to make your applications available temporary from Internet, instead of the localhost14-09-2020

When you are developing new Teams applications, for example, the apps must be available from the the internet before they can be installed and tested in a Team; it cannot be used running from a local IIS.

There are two possibilities to make the Teams app in development reachable from the internet: Hosting the app in a public server, such as Microsoft Azure, or creating a tunnel to the local process on the development machine using Ngrok, an application (available for Windows, Linux, and Mac) that creates public URLs for testing of software that runs in a local development computer.

Ngrok is a free tool that can be downloaded from Unzip Ngrok to a directory on the development computer. Run the Teams app under development from Visual Studio: The app will be available locally from a URL like http://localhost:3333.

Open a PowerShell console, relocate the pointer to the folder where Ngrok is unzipped, and run it using the syntax:

   .\ngrok.exe http 3333 -host-header=localhost:3333

Ensure that you use the same port for the HTTP parameter and the localhost parameter. The console will respond indicating the external URL generated from Ngrok in the form of http(s)://[identifier] For the free version of Ngrok, a session can expand for max 8 hours (it is not necessary to register in the Ngrok site to use the free version). From this moment, the application available locally under the URL http://localhost:3333 will be also available from the public internet URL http(s)://[identifier] To stop the tunnel, use the command Ctrl-c.

Tunneling using Ngrok is valid for testing running the app on the local machine and creates a tunnel to it through a public web endpoint, but it is not suitable for production. When using the Teams App Studio to create the manifest, a message will appear indicating this. The message can be voided for testing, but not when the application will be deployed for production.

Ngrok provides a real-time web user interface as well, to gather all the HTTP traffic running over the tunnel. After starting Ngrok, open the URL given under Web Interface in the PowerShell window (for example, in a web browser to review all the traffic details.

The Status window offers a plethora of information about configuration and Metrics.

Return to Blogs