Using Microsoft Online Modules that require authentication popup

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
Sthompson
Posts: 1
Last visit: Wed Oct 20, 2021 4:38 am

Using Microsoft Online Modules that require authentication popup

Post by Sthompson »

Hi,

Hoping this will be really simple, I am trying to use Connect-MicrosoftTeams when my form loads. In PowerShell, this will open a Microsoft 365 login screen which allows you to login with your credentials to create the remote PowerShell session with the Microsoft Tenant.

When executing this, there is no popup for credentials which causes this to hang and not connect.

How can I get this popup to enter the credentials?

Thanks,
Steve.

Product, version and build:5.8.194
Operating system: Windows 10
PowerShell version(s): v5.1

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

User avatar
brittneyr
Site Admin
Posts: 917
Last visit: Tue Nov 30, 2021 7:16 am
Answers: 21
Been upvoted: 17 times

Re: Using Microsoft Online Modules that require authentication popup

Post by brittneyr »

[Topic moved by moderator]
Brittney Ryn
SAPIEN Technologies, Inc.

jvierra
Posts: 14986
Last visit: Tue Nov 30, 2021 9:48 pm
Answers: 15
Has voted: 3 times
Been upvoted: 12 times

Re: Using Microsoft Online Modules that require authentication popup

Post by jvierra »

Simple answer. You can't.

Depending on the version of the Cmdlets you can try setting MTA which works with some Cmdlets but the best method is to post in the "Teams" developer web forum for methods used to persist credentials outside of the process. You can also connect before the form is created then call the form function.

Here is the fundamental method that works in most cases. I recommend actually building the example which is mostly copying it and testing. Be sure to have the latest "Teams" module installed.

https://www.reddit.com/r/PowerShell/com ... ms_in_gui/

Locked