-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Description
Powershell 7.5.5
Az 15.4.0
The Connect-AzAccount command fails due to the following:
Connect-AzAccount
Please select the account you want to login with.
WARNING: Unable to acquire token for tenant 'organizations' with error 'Method not found: 'System.Threading.Tasks.Task1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.' Connect-AzAccount: Method not found: 'System.Threading.Tasks.Task1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.
The assemblies from Az Modules folder are not loaded, while assemblies from GAC loads:
[System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.Location -like "GAC" }
GAC Version Location
False v4.0.30319 C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\Azure.Identity\v4.0_1.14.2.0__92742159e12e44c8\Azure.Identity.dll
False v4.0.30319 C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\Azure.Core\v4.0_1.47.1.0__92742159e12e44c8\Azure.Core.dll
False v4.0.30319 C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.ClientModel\v4.0_1.5.1.0__92742159e12e44c8\System.ClientModel.dll
This was tested with pwsh -NoProfile
Can the issue becaused by the logic in tools/Tools.Common/Loaders/AssemblyLoader.cs ?
Issue script & Debug output
Connect-AzAccount
DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Core]. PSVersion is [7.5.5].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\PowershellModules\Az.Accounts\5.3.3\StartupScripts\..\lib].
DEBUG: Registering Az shared AssemblyLoadContext.
DEBUG: AssemblyLoadContext registered.
DEBUG: Initializing PSStyle.
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 8:56:25 - ConnectAzureRmAccountCommand begin processing with ParameterSet 'UserWithSubscriptionId'.
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Connect-AzAccount]. Returning default value [True].
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [DefaultSubscriptionForLogin], Module = [], Cmdlet = []. Returning default value [].
DEBUG: 8:56:25 - Autosave setting from startup session: 'CurrentUser'
DEBUG: 8:56:25 - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 8:56:25 - Using Autosave scope 'CurrentUser'
Please select the account you want to login with.
WARNING: Unable to acquire token for tenant 'organizations' with error 'Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.'
DEBUG: 8:56:25 - Unable to acquire token for tenant 'organizations' with error 'System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.
at Microsoft.Azure.PowerShell.Authenticators.InteractiveUserAuthenticator.Authenticate(AuthenticationParameters parameters, CancellationToken cancellationToken)
at Microsoft.Azure.Commands.Common.Authentication.DelegatingAuthenticator.TryAuthenticate(AuthenticationParameters parameters, CancellationToken cancellationToken, Task`1& token)
at Microsoft.Azure.Commands.Common.Authentication.DelegatingAuthenticator.TryAuthenticate(AuthenticationParameters parameters, CancellationToken cancellationToken, Task`1& token)
at Microsoft.Azure.Commands.Common.Authentication.DelegatingAuthenticator.TryAuthenticate(AuthenticationParameters parameters, Task`1& token)
at Microsoft.Azure.Commands.Common.Authentication.Factories.AuthenticationFactory.Authenticate(IAzureAccount account, IAzureEnvironment environment, String tenant, SecureString password, String promptBehavior, Action`1 promptAction, IDictionary`2 optionalParameters)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.AcquireAccessToken(IAzureAccount account, IAzureEnvironment environment, String tenantId, SecureString password, String promptBehavior, Action`1 promptAction, String claimsChallenge, String resourceId)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.ListAccountTenants(IAzureAccount account, IAzureEnvironment environment, SecureString password, String promptBehavior, Action`1 promptAction)'
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [Az.Accounts], Cmdlet = [Connect-AzAccount]. Returning default value [False].
Connect-AzAccount: Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Connect-AzAccount]. Returning default value [True].
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [LoginExperienceV2], Module = [], Cmdlet = []. Returning default value [On].
DEBUG: 8:56:25 - [ConfigManager] Got [False] from [EnableLoginByWam], Module = [], Cmdlet = [].
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:5.3.3; CommandName: Connect-AzAccount; PSVersion: 7.5.5; IsSuccess: False; Duration: 00:00:00.2984335; SanitizeDuration: 00:00:00; Exception: Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.;
DEBUG: 8:56:25 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 8:56:25 - ConnectAzureRmAccountCommand end processing.Environment data
Name Value
---- -----
PSVersion 7.5.5
PSEdition Core
GitCommitId 7.5.5
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Module versions
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 5.3.3 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}Error output
Resolve-AzError
DEBUG: 8:59:41 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 8:59:41 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 8:59:41 - using account id '*REDACTED*'...
DEBUG: 8:59:41 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [Az.Accounts], Cmdlet = [Resolve-AzError]. Returning default value [True].
DEBUG: 8:59:41 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
HistoryId: 2
Message : Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.InteractiveBrowserCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Thre
ading.CancellationToken)'.
StackTrace : at Microsoft.Azure.PowerShell.Authenticators.InteractiveUserAuthenticator.Authenticate(AuthenticationParameters parameters, CancellationToken cancellationToken)
at Microsoft.Azure.Commands.Common.Authentication.DelegatingAuthenticator.TryAuthenticate(AuthenticationParameters parameters, CancellationToken cancellationToken, Task`1& token)
at Microsoft.Azure.Commands.Common.Authentication.DelegatingAuthenticator.TryAuthenticate(AuthenticationParameters parameters, CancellationToken cancellationToken, Task`1& token)
at Microsoft.Azure.Commands.Common.Authentication.DelegatingAuthenticator.TryAuthenticate(AuthenticationParameters parameters, Task`1& token)
at Microsoft.Azure.Commands.Common.Authentication.Factories.AuthenticationFactory.Authenticate(IAzureAccount account, IAzureEnvironment environment, String tenant, SecureString password, S
tring promptBehavior, Action`1 promptAction, IDictionary`2 optionalParameters)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.AcquireAccessToken(IAzureAccount account, IAzureEnvironment environment, String tenantId, SecureString password, String p
romptBehavior, Action`1 promptAction, String claimsChallenge, String resourceId)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.ListAccountTenants(IAzureAccount account, IAzureEnvironment environment, SecureString password, String promptBehavior, Ac
tion`1 promptAction)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantIdOrName, String subscriptionId, String subscrip
tionName, SecureString password, Boolean skipValidation, IOpenIDConfiguration openIDConfigDoc, Action`1 promptAction, String claimsChallenge, String name, Boolean shouldPopulateContextList, I
nt32 maxContextPopulation, String authScope, Boolean IsInteractiveContextSelectionEnabled)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass138_2.<ExecuteCmdlet>b__8()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass138_1.<ExecuteCmdlet>b__2(AzureRmProfile localProfile, RMProfileClient profileClient, String name)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass155_0.<SetContextWithOverwritePrompt>b__0(AzureRmProfile prof, RMProfileClient client)
at Microsoft.Azure.Commands.Profile.Common.AzureContextModificationCmdlet.ModifyContext(Action`2 contextAction)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.SetContextWithOverwritePrompt(Action`3 setContextAction)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : System.MissingMethodException
InvocationInfo : {Connect-AzAccount}
Line : Connect-AzAccount
Position : At line:1 char:1
+ Connect-AzAccount
+ ~~~~~~~~~~~~~~~~~
HistoryId : 2
DEBUG: 8:59:41 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 8:59:41 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 8:59:41 - No authentication telemetry is found for the current cmdlet with Id 19200ac8-b0c4-4b01-901b-055963cd6954.
DEBUG: AzureQoSEvent: Module: Az.Accounts:5.3.3; CommandName: Resolve-AzError; PSVersion: 7.5.5; IsSuccess: True; Duration: 00:00:00.1874701; SanitizeDuration: 00:00:00.0025624
DEBUG: 8:59:41 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 8:59:42 - ResolveError end processing.