You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ az repos list --project myproject --detect false
See error about missing organization information in command invokation
Expected behavior
Organization should be picked-up from defaults configuration set as environment variable
Debug logs
$ az repos list --project myproject --detect false --debug
cli.knack.cli: Command arguments: ['repos', 'list', '--project', 'myproject', '--detect', 'false', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f464fd87d08>, <function OutputProducer.on_global_arguments at 0x7f464fdf8b70>, <function CLIQuery.on_global_arguments at 0x7f464fcd3950>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'repos': ['azext_devops']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: azure-devops 0.019 60 191 /home/vscode/.azure/cliextensions/azure-devops
cli.azure.cli.core: Total (1) 0.019 60 191
cli.azure.cli.core: Loaded 60 groups, 191 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : repos list
cli.azure.cli.core: Command table: repos list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f464f80c9d8>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/vscode/.azure/commands/2021-04-20.23-35-24.repos_list.1464.log'.
az_command_data_logger: command args: repos list --project {} --detect {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f464f7b1950>, <function register_global_query_examples_argument.<locals>.register_query_examples at 0x7f464f786950>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f464f7869d8>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f464f786ae8>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f464fdf8ae8>, <function CLIQuery.handle_query_parameter at 0x7f464fcd39d8>, <function register_global_query_examples_argument.<locals>.handle_example_parameter at 0x7f464f7868c8>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7f464f786a60>, <function DevCommandsLoader.post_parse_args at 0x7f464f1e49d8>]
az_command_data_logger: extension name: azure-devops
az_command_data_logger: extension version: 0.18.0
cli.azext_devops.dev.common.exception_handler: handling generic error
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 712, in _run_job
return cmd_copy.exception_handler(ex)
File "/home/vscode/.azure/cliextensions/azure-devops/azext_devops/dev/common/exception_handler.py", line 31, in azure_devops_exception_handler
reraise(*sys.exc_info())
File "/opt/az/lib/python3.6/site-packages/six.py", line 703, in reraise
raise value
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 807, in default_command_handler
return op(**command_args)
File "/home/vscode/.azure/cliextensions/azure-devops/azext_devops/dev/repos/repository.py", line 62, in list_repos
project=project)
File "/home/vscode/.azure/cliextensions/azure-devops/azext_devops/dev/common/services.py", line 363, in resolve_instance_and_project
detect=detect, organization=organization, project=project, project_required=project_required)
File "/home/vscode/.azure/cliextensions/azure-devops/azext_devops/dev/common/services.py", line 341, in resolve_instance_project_and_repo
organization = _resolve_instance_from_config(organization)
File "/home/vscode/.azure/cliextensions/azure-devops/azext_devops/dev/common/services.py", line 379, in _resolve_instance_from_config
raise _team_organization_arg_error()
knack.util.CLIError: --organization must be specified. The value should be the URI of your Azure DevOps organization, for example: https://dev.azure.com/MyOrganization/ or your Azure DevOps Server organization. You can set a default value by running: az devops configure --defaults organization=https://dev.azure.com/MyOrganization/. For auto detection to work (--detect true), you must be in a local Git directory that has a "remote" referencing a Azure DevOps or Azure DevOps Server repository.
cli.azure.cli.core.azclierror: --organization must be specified. The value should be the URI of your Azure DevOps organization, for example: https://dev.azure.com/MyOrganization/ or your Azure DevOps Server organization. You can set a default value by running: az devops configure --defaults organization=https://dev.azure.com/MyOrganization/. For auto detection to work (--detect true), you must be in a local Git directory that has a "remote" referencing a Azure DevOps or Azure DevOps Server repository.
az_command_data_logger: --organization must be specified. The value should be the URI of your Azure DevOps organization, for example: https://dev.azure.com/MyOrganization/ or your Azure DevOps Server organization. You can set a default value by running: az devops configure --defaults organization=https://dev.azure.com/MyOrganization/. For auto detection to work (--detect true), you must be in a local Git directory that has a "remote" referencing a Azure DevOps or Azure DevOps Server repository.
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f464f80cbf8>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 0.449 seconds (init: 0.110, invoke: 0.340)
telemetry.save: Save telemetry record of length 3592 in cache
telemetry.check: Negative: The /home/vscode/.azure/telemetry.txt was modified at 2021-04-20 23:29:29.967329, which in less than 600.000000 s
Additional context
I confirmed the configuration is properly set as env variables with following commands ran from same shell:
$ az devops configure -l
Use git alias = No
Environment variables:
AZURE_DEVOPS_EXT_DEFAULTS_ORGANIZATION
As this is used on an Azure DevOps build agent, running concurrent jobs, I cannot use az devops configure as this will impact the concurrent jobs. Settings the environment variables in the job context, as support per Azure CLI, seems to be the only solution in this case!
I am not sure I understand the "as designed" for DevOps CLI extension in this case, as it does NOT match the default Azure CLI behavior...
Describe the bug
Defaults configurations defined as environment variables are not honored when invoking devops commands
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Organization should be picked-up from defaults configuration set as environment variable
Debug logs
Additional context
I confirmed the configuration is properly set as env variables with following commands ran from same shell:
and
The text was updated successfully, but these errors were encountered: