module Az.Accounts supported in a GUI/Windows.Forms?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
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
angelofstealth
Posts: 69
Last visit: Tue May 11, 2021 10:28 pm

module Az.Accounts supported in a GUI/Windows.Forms?

Post by angelofstealth »

Is using module Az.Accounts supported in a GUI/Windows.Forms? Seeing a bunch of articles in regards to Connect-AzAccount; Looking for clarification if this is even supported. Works fine in console/command line. Importing the module just hangs the GUI, any other module works fine.

Version of PS 5.1, have 2.2.8 of Az.Accounts installed.

Thanks,

jvierra
Posts: 14836
Last visit: Sat Jun 19, 2021 7:13 am
Answers: 10
Has voted: 3 times
Been upvoted: 10 times

Re: module Az.Accounts supported in a GUI/Windows.Forms?

Post by jvierra »

I have not found any MS online modules that Microsoft has ever said were not supported. Check with Microsoft documentation for the module as they change things with Azure constantly.

Some modules must be imported before the form is called. Use a project to load the module in the "startup.pss" file which executes before the form is called.

User avatar
angelofstealth
Posts: 69
Last visit: Tue May 11, 2021 10:28 pm

Re: module Az.Accounts supported in a GUI/Windows.Forms?

Post by angelofstealth »

Thanks jvierra, will give that a shot. Appreciate the response, cheers

jvierra
Posts: 14836
Last visit: Sat Jun 19, 2021 7:13 am
Answers: 10
Has voted: 3 times
Been upvoted: 10 times

Re: module Az.Accounts supported in a GUI/Windows.Forms?

Post by jvierra »

You are welcome.

One last thing. Learning how to use sophisticated systems like Micorsoft online services is a big challenge even for experienced programmers. Be patient and follow the blogs and the Azure web site and information. The videos have gotten quite good. Also PowerShell was not initially intended to be used with other than simple forms but it can be used in most ways with forms and Net assemblies and with most modules. The trick is to understand the differences between a script running in a form and one running outside of a form. Modules run at a prompt but the threading and behavior of a form can be different so check and experiment with the thread model (STA/MTA).

Locked