azure-powershell
azure-powershell copied to clipboard
Connect-AzAccount hangs in Visual Studio Code terminal
Description
When using "Connect-AzAccount" it hangs in the terminal with the message "Please select the account you want to login with."
I can't actually select a subscription however, it just hangs at that point with a "pop-behind" login prompt. That is, the Windows authentication UI appears under the Visual Studio Code window.
PS: The exact same behavior is observed with Out-GridView, or any other PowerShell GUI element launched from the VS Code console.
Issue script & Debug output
Connect-AzAccount
DEBUG: 12:51:35 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:51:35 PM - ConnectAzureRmAccountCommand begin processing with ParameterSet 'UserWithSubscriptionId'.
DEBUG: 12:51:35 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:51:35 PM - [ConfigManager] Got [########-####-####-####-#########] from [DefaultSubscriptionForLogin], Module = [], Cmdlet = [].
DEBUG: 12:51:35 PM - [ConnectAzureRmAccountCommand] Using default subscription "########-####-####-####-#########" from config.
DEBUG: 12:51:35 PM - Autosave setting from startup session: 'CurrentUser'
DEBUG: 12:51:35 PM - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 12:51:35 PM - Using Autosave scope 'CurrentUser'
Please select the account you want to login with.
Environment data
Name Value
---- -----
PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 3.0.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Error output
DEBUG: 12:53:11 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:53:11 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 12:53:11 PM - using account id '[email protected]'...
DEBUG: 12:53:11 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:53:11 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:53:11 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:3.0.0; CommandName: Resolve-AzError; PSVersion: 7.4.2; IsSuccess: True; Duration: 00:00:00.0025570; SanitizeDuration: 00:00:00
DEBUG: 12:53:11 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: 12:53:11 PM - ResolveError end processing.
Thanks for reporting :) @msJinLei we may want to (a) check if our utlity of getting the handle of the parent window is up to date with MSAL's recommeded implementation and (b) escalate to MSAL team.
@isra-fel No update for document from MSAL team https://learn.microsoft.com/en-us/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam
@peter-bertok Can you see the popup windows? Or could you provide a screen snapshot for the case you encountered?
When I run the Connect-AzAccount command, the popup window is not visible.
It appears* behind* the VS Code window, as a "pop behind". If I carefully minimise the VS Code Window or change its size and drag it around, I can click on the login window. Otherwise it is invisible and cannot be easily selected.
On Tue, 28 May 2024 at 13:56, Jin Lei @.***> wrote:
@peter-bertok https://github.com/peter-bertok Can you see the popup windows? Or could you provide a screen snapshot for the case you encountered?
— Reply to this email directly, view it on GitHub https://github.com/Azure/azure-powershell/issues/24989#issuecomment-2134302471, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSLGW23BGAD7K3YOP2IIRLZEP6AVAVCNFSM6AAAAABIKLNR4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUGMYDENBXGE . You are receiving this because you were mentioned.Message ID: @.***>
When I run the Connect-AzAccount command, the popup window is not visible. It appears* behind* the VS Code window, as a "pop behind". If I carefully minimise the VS Code Window or change its size and drag it around, I can click on the login window. Otherwise it is invisible and cannot be easily selected. … On Tue, 28 May 2024 at 13:56, Jin Lei @.> wrote: @peter-bertok https://github.com/peter-bertok Can you see the popup windows? Or could you provide a screen snapshot for the case you encountered? — Reply to this email directly, view it on GitHub <#24989 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSLGW23BGAD7K3YOP2IIRLZEP6AVAVCNFSM6AAAAABIKLNR4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUGMYDENBXGE . You are receiving this because you were mentioned.Message ID: @.>
Got it. The popup windows is not easy to find.
Reported to MSAL team
@msJinLei in my case there is no pop-behind whatsoever, following the same instructions noted here.
@msJinLei in my case there is no pop-behind whatsoever, following the same instructions noted here.
@JustinGrote Could you run Connect-AzAccount -Debug and paste and debug log here and remember to remove the private information
@msJinLei in my case there is no pop-behind whatsoever, following the same instructions noted here.
@JustinGrote Could you run Connect-AzAccount -Debug and paste and debug log here and remember to remove the private information
i wasn't seeing any pop up either. however I found it hidden behind many open apps in the end. it was a modern auth pop up. previous experience was to open the browser. Then after the pop up, i see the following... and was able to connect.
Please select the account you want to login with.
Retrieving subscriptions for the selection...
[Announcements]
With the new Azure PowerShell login experience, you can select the subscription you want to use more easily. Learn more about it and its configuration at https://go.microsoft.com/fwlink/?linkid=2271909.
If you encounter any problem, please open an issue at: https://aka.ms/azpsissue
Same here, popup does show, but it doesnt literally pop up, it will get displayed behind all active apps you have running. More like pop-under!
Hello, I wanted to add one more thing to this. If you use multiple desktops it is possible that the window won't show up on the current desktop. Also, the window does not seem to have an icon in the task bar so it makes it extremely difficult to find.
I still have the same issue as @shaneholder and @erwinkramer. It is just because the window credentials was under all my active apps !
Will this be addressed? Seems like this has been an issue for a long time. I am forced to stay on az.accounts 2.9.1 until this is resolved.
I just tested and it works fine for me in PowerShell Extension Terminal.
Still broken as of today, with the latest VS Code and the latest Az module. The login pops in behind the IDE window, not in front of it like it should. This is trivial to reproduce.