az devops 登录挂起

use*_*078 5 azure-devops azure-devops-extensions

我正在使用 Windows 10、Azure PowerShell Az 模块、DevOps 扩展 0.18.0

我已登录 DevOps 实例并能够运行所有相关命令。现在,我需要登录到不同的组织/项目。每次执行登录子命令时,窗口都会挂起并锁定,我必须重新启动 PowerShell ISE 才能重试。

我正在使用的命令(我已经尝试了几种变体)是:

> az login 
> $env:AZURE_DEVOPS_EXT_PAT ='{PAT}' 
> az devops login --organization https://dev.azure.com/{org} --debug
Run Code Online (Sandbox Code Playgroud)

挂在这里!

调试日志如下

az devops login --organization https://dev.azure.com/{org} --debug

CategoryInfo          : NotSpecified: (Command argumen...nn', '--debug']:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError   Event: Cli.PreExecute [] Event: CommandParser.OnGlobalArgumentsCreate
[<function CLILogging.on_global_arguments at 0x03A171E0>, <function 
OutputProducer.on_global_arguments at 0x03B3AA98>, <function
CLIQuery.on_global_arguments at 0x03B5CCD8>] Event:
CommandInvoker.OnPreCommandTableCreate [] Modules found from index for
'devops': ['azext_devops'] Loading command modules: Name              
Load Time    Groups  Commands Total (0)                 0.000        
0         0 These extensions are not installed and will be skipped:
['azext_ai_examples', 'azext_ai_did_you_mean_this'] Loading
extensions: Name                  Load Time    Groups  Commands 
Directory azure-devops              0.110        60       191 
C:\Users\{username}\.azure\cliextensions\azure-devops Total (1)          
0.110        60       191   Loaded 60 groups, 191 commands. Found a match in the command table for 'devops login' Event:
CommandInvoker.OnPreCommandTableTruncate [<function
AzCliLogging.init_command_file_logging at 0x03C2B978>]
az_command_data_logger : command args: devops login --organization {}
--debug metadata file logging enabled - writing logs to 'C:\Users\{username}\.azure\commands'. Event:
CommandInvoker.OnPreArgumentLoad [<function
register_global_subscription_argument.<locals>.add_subscription_parameter
at 0x03D69660>] Event: CommandInvoker.OnPostArgumentLoad [] Event:
CommandInvoker.OnPostCommandTableCreate [<function
register_ids_argument.<locals>.add_ids_arguments at 0x03D69618>,
<function  register_cache_arguments.<locals>.add_cache_arguments at
0x03D69E40>] Event: CommandInvoker.OnCommandTableLoaded [] Event:
CommandInvoker.OnPreParseArgs [] Event: CommandInvoker.OnPostParseArgs
[<function OutputProducer.handle_output_argument at 0x03B3AAE0>,
<function CLIQuery.handle_query_parameter  at 0x03B5CD20>, <function
register_ids_argument.<locals>.parse_ids_arguments at 0x03D69DF8>,
<function DevCommandsLoader.post_parse_args at  0x03CF6150>]
az_command_data_logger : extension name: azure-devops
az_command_data_logger : extension version: 0.18.0
Run Code Online (Sandbox Code Playgroud)
  • 我已重新启动 Windows 10
  • 我已注销 az (az logout)
  • 我已注销 devops (az devops logout)
  • 我始终以提升的权限(管理员)运行 PowerShell ISE

我已经确认,在完成这一切之后,我仍然可以从我开始的组织/项目访问 DevOps(管道、版本等)。所以注销也失败。

到底是怎么回事?有什么想法为什么会发生这种情况吗?

Mer*_*SFT 0

现在,我需要登录到不同的组织/项目。

场景 1:目标组织/项目仍在同一用户帐户下

如果您要使用的目标组织/项目仍在同一用户帐户下,此时您不需要注销并重新登录。

只需运行以下命令即可使用以下命令更改默认组织/项目:

az devops configure --defaults organization=https://dev.azure.com/{org name}
Run Code Online (Sandbox Code Playgroud)

然后,您将可以与另一个组织/项目合作,而无需重新登录。

场景 2:目标组织/项目位于另一个用户帐户下

如果实际情况是您必须更改为使用另一个帐户登录才能使用该组织/项目,请先运行以下命令注销:

az logout --username "{another account}"
Run Code Online (Sandbox Code Playgroud)

然后重新运行az login以使用另一个帐户地址登录。你现在应该成功了。

在此输入图像描述