Running O365 modules like Connect-MSOLService

Thanks for your responses everyone.

I’m still trying to get my head around Powershell Universal - I found the below errors in the logs of the dashboard:

Oct 15, 2021 1:18 PM An error occurred: Could not load type 'System.IdentityModel.Tokens.JwtSecurityToken' from assembly 'System.IdentityModel.Tokens.Jwt, Version=6.7.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Endpoint: e29edd93-fbe1-48be-b106-167b4f23a878
Session: ae954ecf-c6d2-4205-bc05-b5e3690823d1
File: C:\ProgramData\UniversalAutomation\Repository\dashboards\MFA Reset Tool\MFA Reset Tool.ps1
Endpoint Start Line: 8
Endpoint End Line: 25
Stack Trace: at <ScriptBlock>, <No file>: line 12

I’ve tried running in the default powershell env, the integrated powershell env and via 5.1 or 7.x with the same issues. It’s not clear to me why this works fine everywhere else on the server but not when the code is run through Powershell Ultimate dashboard.
This seems to be the same issue as in this thread, and it doesn’t seem like a clear solution was found:

It’s a bit of a wild goose chase right now - is there a clear way I can specify which dependencies PU is going to use explicitly when running it such as .NET version and Powershell version?