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.
Login Into Azure
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.
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.
- mxtrinidad
- Posts: 399
- Last visit: Tue May 16, 2023 6:52 am
Re: Login Into Azure
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!
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!
Re: Login Into Azure
Thanks, I'll investigate about Az Context, and see if can find a way to get this work.
Best regards.
Best regards.