Login Into Azure

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 4 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.
Locked
User avatar
dlaurora
Posts: 31
Last visit: Wed Oct 02, 2019 12:51 pm

Login Into Azure

Post by dlaurora »

Hello guys,

I'm creating a simple Powershell gui with a responsive form to turn on/ff and reboot VMs in Azure. The only issue that I have is when I try to login into Azure, the prompt appears, ask for credentials and then for a second authentication (our company has Symantec Vip authenticator) it just disappears.

In PowerShell works like a charm, I can log in with both credentials.

Is there any special way in Powershell Studio for login into Azure?

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

Re: Login Into Azure

Post by mxtrinidad »

Unfortunately No! This is an ongoing issue with Azure as they want you to use the browser to initially authenticate to the cloud. You need to use the following command lines options.

There are two ways deal with this issue and all end up with doing trail/error for testing if it works.

1. Login once then use the "Enable-AzContextAutoSave". This will make the connection Azure stays even when closing you PowerShell session. Using the "Disable-AzContextAutoSave" will stop the auto login to Azure.

2. Or, after login once, you can use the "Save-AzContext", then it can be use with "Import-AzContext". The saved file is a Json type and places in the folder you pick to save it.

Check out the following blog post for an example using the "Import-AzContext": https://www.sapien.com/blog/2018/07/19/ ... ound-jobs/

Please notice in the example, all AzureRm cmdlets may need to change to the newer format from "AzureRm" to "Az".

Hope this help!
:)
User avatar
dlaurora
Posts: 31
Last visit: Wed Oct 02, 2019 12:51 pm

Re: Login Into Azure

Post by dlaurora »

Thanks, I'll investigate about Az Context, and see if can find a way to get this work.

Best regards.
This topic is 4 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.
Locked