Azure command don't work.

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

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 5 years and 10 months 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.
User avatar
drpiet
Posts: 22
Last visit: Thu Oct 06, 2022 11:07 am

Azure command don't work.

Post by drpiet »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: PowerShell Studio 2018 v5.5.152
32 or 64 bit version of product: 64 bits
Operating system:
32 or 64 bit OS: Windows 10 - 64 bits



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

I need to start a new project, this will be 100% Azure related but it is a challenge to have pretty simple things working.
I'm trying to login to the azure account, I can't pass credentials on the login-azurermaccount because we use MFA. I even try running "login-azurermaccount" from the console integrated on Powershell Studio and does absolutely nothing, the console never return the control and I have to do a restart shell.
Of course exactly the same command work perfectly well on the regular powershell console.

So at this point my question is: Is supported to work with Azure commands on Powershell Studio? If so, what is going on with my installation?

Thanks in advance
Diego Pietruszka
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Azure command don't work.

Post by mxtrinidad »

First, you can work with Azure/AzureM cmdlets with PowerShell Studio. Just make sure you always the Azure modules latest version (if possible).
Now, for automation purpose, test the following outside PowerShell Studio:

1. After your initially have successfully login to your Subscription, execute the command:

Code: Select all

## - Create JSON profile: 
$AzRmInfo = Save-AzureRmContext -Path "c:\storeJson\AzureSubscriptions\MyAsubRMprofile_test.json";
$AzRmInfo.context | Select-Object Environment, Account;
2. Disconnect from Azure, and try to following commands:

Code: Select all

## - Use JSON file to connect to AzureSubscription:
$AzRmInfo = Import-AzureRmContext -Path "c:\storeJson\AzureSubscriptions\MyAsubRMprofile_test.json";
$AzRmInfo.context | Select-Object Environment, Account;
The end result should be that you'll get connected without any prompt for credentials.

If this works for you, then you could apply this technique to the rest of your solution.

Now, I'm not using MFA so here's a link that might help: https://docs.microsoft.com/en-us/azure/ ... entication

As long you are connected with Azure, then you create scripts and execute commands from PowerShell Studio.

:)
User avatar
drpiet
Posts: 22
Last visit: Thu Oct 06, 2022 11:07 am

Re: Azure command don't work.

Post by drpiet »

Thanks for your reply.
Yes, I'm aware of the AzureRMContext, but as you can imagine that is a huge security risk, that file is a free key to your azure world (besides that, I kind of remember the file is valid for a certain period of time)..

Anyway, my point here is:

I run login-azurermaccount on powershell and I have what I'm expecting, the login screen (supporting MFA).
If a run login-azurermaccount on the Poweshell Studio console, the command just hung in there (without showing any login screen) until I restart the shell. I tried launching PS Studio as admin, restarting the machine and even with PS Studio on different computer and all of them have the same behavior.

For the nature of the application I'm planning, "login-azurermaccount" will be between the first 5 lines of my code :-( so I really need to sort this out. It sounds to me for all the test I did so far, this is a bug, but I would like for you guys to confirm.

Thanks
Diego
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Azure command don't work.

Post by mxtrinidad »

One thing we need to check is what version of AzureRM you got installed. The test I've been doing use version 5.4.1.
But I realized that's an old version. The new version is 6.1.1.

I'm currently removing AzureRM version 5.4.1 to install 6.1.1 just to make sure is working.

I can tell you, there's no bug with PowerShell Studio. I can execute AzureRM "loginAzureRMAccount" in both Window 32/64bit consoles in PowerShell Studio and see the Web browser page asking for the login.

But Wait!! This reminds me, If you can't see the browser page, its means is hiding behind the PowerShell Studio application.
It doesn't popup in front of PowerShell Studio!

So, try again and look behind the application.
User avatar
drpiet
Posts: 22
Last visit: Thu Oct 06, 2022 11:07 am

Re: Azure command don't work.

Post by drpiet »

I feel absolutely ashamed :oops:
I was minimizing Powershell Studio, but my form was behind absolutely everything.

Thanks a lot
Diego
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Azure command don't work.

Post by mxtrinidad »

No worries!! You gave me the hint... And I'm so used to look behind the app that it has become normal behavior.
Please reach out if you have any issues.

Thanks!
This topic is 5 years and 10 months 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.