Azure / azure-devops-cli-extension

Azure DevOps Extension for Azure CLI
https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/?view=azure-cli-latest
MIT License
617 stars 239 forks source link

[Bug report] az devops invoke should support --url parameter #1315

Open jikuja opened 1 year ago

jikuja commented 1 year ago

Is your feature request related to a problem? Please describe. Current implementation of az devops invoke fetches information fromGET /{organisation}/_apis/ResourceAreas. Some resource areas are missing from the endpoint and they cannot be used with az devops invoke command. Missing e.g.

Describe the solution you'd like Allow passing full URL to CLI without using information fetched from GET /{organisation}/_apis/ResourceAreas and OPTIONS /{organisation}/_apis?allHostTypes=True at all

Alternative solution is to work with ADO API owners and add all missing resource area definitions

Additional context Running az devops invoke --debug --org https://dev.azure.com/xxxx/ --area securityroles --resource scopes --http-method GET fails with

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 "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/Users/janne.kujanpaa/.azure/cliextensions/azure-devops/azext_devops/dev/common/exception_handler.py", line 31, in azure_devops_exception_handler
    reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/six.py", line 703, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/Users/janne.kujanpaa/.azure/cliextensions/azure-devops/azext_devops/dev/team/invoke.py", line 79, in invoke
    raise CLIError('--area is not present in current organization')
knack.util.CLIError: --area is not present in current organization

cli.azure.cli.core.azclierror: --area is not present in current organization
az_command_data_logger: --area is not present in current organization
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x106d29360>]
az_command_data_logger: exit code: 1

instead of complaining missing route-parameters or instead of returning error code by GET dev.azure.com/xxx/apis_/securityroles/scopes/...