Thursday, 2 July 2020

Microsoft Teams Development: an ngrok alternative

If you are building a Microsoft Teams app, and if this app requires some SSO capabilities to access either a Microsoft 365 resource or any other own built API that you choose to protect using Azure AD.

You will need to define the API using your own domain as a prefix, not an issue however right?  however when you try to get Microsoft teams authentication token your Tab iframe need to be loaded via the exact same domain.

one quick tool I've used in the past is ngrok, which provides a subdomain to * however with the free version you can't have a permanent subdomain so eventually you will have to change the domain while you're developing from now and then and more annoyingly you will have to update the api prefix in Azure AD

Which in my honest opinion is too much so how I can update my Teams app and test it without continuously changing the prefix domain Application ID URI, one option is to use ngrok in a non-free capacity.

The other option is to ditch ngrok all together and use Fiddler, yes fiddler they offer a tool that allows you to map a domain name to a specific IP & Port similar to hosts file with the advantage of specify a port

using fiddler Host mapping tool, I can point my local dev environment to my actual domain and I don't need to keep changing the Azure AD Application ID URI.

The drawback of this that you would have fiddler running in a capture mode to enable this, you could also limit the capture to your domain using fiddler filters.