Powershell connect-microsoftteams mfa via userform generates unhandled exception

Copper Contributor

Hi, I'm trying to create a gui frontend to a number of scripts to make them easier to access and use for colleagues . Some of the scripts require connections to O365 admins like connect-microsoftteams. At first the MFAs for the connects wouldn't even appear. Uncle google advised to use Powershell 7 when connecting through userforms. Which we installed and that did make the MFAs appear. However, when authenticating the MFA, I get a unhandled exception (an issue with the parameter 'session') and MFA browser window says 'Can't reach this page'. And the url of the MFA browser window is calling an odd localhost:..... url. clicking Continue on the unhandled exception does nothing

Outside of the gui, the connections work fine.

I've tried:

try-catch block, no change


netsh winhttp reset proxy, no change




Any ideas how I can get passed this?

1 Reply
I think I found the answer. Simply switch the default browser to MS Edge.