Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.81k forks source link

Connect-AzAccount hangs in Visual Studio Code terminal #24989

Open peter-bertok opened 3 months ago

peter-bertok commented 3 months ago

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 'username@orgname.onmicrosoft.com'...
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.
isra-fel commented 3 months ago

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.

msJinLei commented 3 months ago

@isra-fel No update for document from MSAL team https://learn.microsoft.com/en-us/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam

msJinLei commented 3 months ago

@peter-bertok Can you see the popup windows? Or could you provide a screen snapshot for the case you encountered?

peter-bertok commented 3 months ago

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: @.***>

msJinLei commented 3 months ago

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.

msJinLei commented 1 month ago

Reported to MSAL team

JustinGrote commented 1 week ago

@msJinLei in my case there is no pop-behind whatsoever, following the same instructions noted here.

msJinLei commented 1 week ago

@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 commented 1 week ago

@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