AzureRM commandlets give problems

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.
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
JorisK1980
Posts: 30
Last visit: Fri Nov 16, 2018 1:40 am

AzureRM commandlets give problems

Post by JorisK1980 »

Product, version and build: PS Studio 2018 1.0.26
Operating system: 2016 64bit

The issue:

When i start a new project, i create a simple form based project. At form_load or button_click, I start loading the AzureRM module which has been installed on the system successfully.

I have a very small script that logs on into Azure successfully, after that, it starts a simple commandlet: Get-AzureRmADApplication -DisplayNameStartWith "XXXXXXXXXXX"

The application hangs, nothing happens.

When i launch it as a script in a seperate/normal powershell window, it works fine.

I can't find any errormessages, the PS Studio log remains silent.

Anyone any idea?
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: AzureRM commandlets give problems

Post by davidc »

[TOPIC MOVED TO POWERSHELL GUIS FORUM BY MODERATOR]

It could be because the GUI is holding up the pipeline. Try using a job (see: Job Tracker control set) to execute the commands.

https://info.sapien.com/index.php/guis/ ... sive-forms
David
SAPIEN Technologies, Inc.
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: AzureRM commandlets give problems

Post by mxtrinidad »

It will help if you can provide what version of AzureRm you're currently using.

Thanks!
User avatar
JorisK1980
Posts: 30
Last visit: Fri Nov 16, 2018 1:40 am

Re: AzureRM commandlets give problems

Post by JorisK1980 »

davidc wrote: Wed Mar 07, 2018 8:50 am [TOPIC MOVED TO POWERSHELL GUIS FORUM BY MODERATOR]

It could be because the GUI is holding up the pipeline. Try using a job (see: Job Tracker control set) to execute the commands.

https://info.sapien.com/index.php/guis/ ... sive-forms
There's nothing piped.

All i do is a simple: Get-AzureRmADApplication -DisplayNameStartWith $Name

GUI completely freezes and never comes back.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: AzureRM commandlets give problems

Post by jvierra »

Yes. This is an issue with Azure running in a form.

Connect and run one Azure command before opening the form and it should work. It does with Get-AzureADGroup.
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: AzureRM commandlets give problems

Post by mxtrinidad »

Yes! There are issues running Azure running in Windows Forms. Microsoft has been implementing the '-AsJob' parameter in some of there cmdlets.

So, as mention before, try using the JobTracker form. But, at the same time, I've seen good results using the *-job cmdlets: Start-Job, Get-Job, and Receive-Job.

We are in process of creating some additional templates to tackle the issue with Azure.
:)
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: AzureRM commandlets give problems

Post by jvierra »

The issue, in al cases that I have tested, has nothing to do with long running commands. The Azure module won'r correctly initialize from inside a form. I think Alex was looking into this with some MS people.

Attached is an example of how to resolve this issue.
Attachments
Test-AzureRM.zip
(33.55 KiB) Downloaded 146 times
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked