Azure-devops-cli-extension: Organization parameter is confusing and has poor error messages on invalid input

Created on 17 Apr 2019  路  13Comments  路  Source: Azure/azure-devops-cli-extension

Is your feature request related to a problem? Please describe.
It was difficult to discover how to use az artifacts universal and I had to look at docs. The error messages were cryptic and unhelpful.

Describe the solution you'd like

  • [x] path parameter does not seem to accept relative paths
  • [ ] The parameter set should be improved. organization does not need to be a full URL, it would make more sense to accept just the organization name (without the https://dev.azure.com/ prefix)
  • [ ] I received an "index out of range" or similar exception using one of the parameters. I think this is from an internal parsing error. This error should be caught and friendly
bug

Most helpful comment

Also seems that the "packages" tag should be removed from this issue, as it occurs agnostic of "packages"

All 13 comments

Organisation and Project are one time configurable parameters. You can set it using -

az devops configure --defaults  organization=https://dev.azure.com/orgname project=projName

The reason for it being a URL is we support more than just "dev.azure.com". Hopefully that will lessen the pain.

For other issues @zarenner Can you please take a look.

You're saying you have to support full URLs so you can parse out https?://(\w+).visualstudio.com/(\w+) and https://dev.azure.com/(\w+)/(\w+). Wouldn't it be easier for you to just have it already parsed out? Then I believe the last bullet would not be an issue because there would not be any parsing.

@chriskuech
Not just visualstudio.com and dev.azure.com. We support Azure Devops server which is an onprem solution and so we need to support full URLs.
Having said that, accepting organization as name instead of URL for hosted solution is still possible but not without its own confusion then for onPrem users who will need to use the full urls.

Did you try out the az devops configure --defaults? Most people are OK with it, if this is still an issue of concern for you do let us know.

Sorry, I haven't tried it because the use case is already checked in, but your argument makes sense. I guess the only ask regarding that would be a friendly error message (ex: Error: organization parameter is not a URL)

I actually did find myself using az devops configure --defaults and it worked nicely. I was able to find the actual error message for the paring error I mentioned

Failed to update Universal Packages tooling.
 list index out of range

Hope that helps

Hi @chriskuech , it looks like you're all squared away here so I'm gonna close this one, let me know if you're still having issues and we'll be glad to help!

I think this issue should be reopened. The original issue is that specifying an improperly formatted --org parameter throws a cryptic error. I just updated and attempted to use a different command but faced the same issue. The error is uninformative and the solution is unintuitive, so it is very difficult to debug. I definitely think this error needs to be handled better, such as specifying that the issue is with --org and how to properly format the values.

C:\Repos> az boards query --org msazure --project FinOps --wiql "select * from workitems"
The command failed with an unexpected error. Here is the traceback:

list index out of range
Traceback (most recent call last):
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\knack\knack\cli.py", line 206, in invoke
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\azure-cli-core\azure\cli\core\commands\__init__.py", line 351, in execute
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\azure-cli-core\azure\cli\core\commands\__init__.py", line 409, in _run_jobs_serially
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\azure-cli-core\azure\cli\core\commands\__init__.py", line 400, in _run_job
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\exception_handler.py", line 26, in azure_devops_exception_handler
    reraise(*sys.exc_info())
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\six\six.py", line 693, in reraise
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\azure-cli-core\azure\cli\core\commands\__init__.py", line 379, in _run_job
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\azure-cli-core\azure\cli\core\commands\__init__.py", line 171, in __call__
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qvpg2q31\azure-cli-core\azure\cli\core\__init__.py", line 451, in default_command_handler
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\boards\work_item.py", line 237, in query_work_items
    client = get_work_item_tracking_client(organization)
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\services.py", line 273, in get_work_item_tracking_client
    connection = get_connection(organization)
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\services.py", line 43, in get_connection
    credentials = _get_credentials(organization)
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\services.py", line 56, in _get_credentials
    if PAT_ENV_VARIABLE_NAME in os.environ or get_credential(organization) is not None:
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\_credentials.py", line 17, in get_credential
    token = _get_credential(organization)
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\_credentials.py", line 24, in _get_credential
    key = _get_service_name(organization)
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\_credentials.py", line 76, in _get_service_name
    return 'azdevops-cli:' + normalize_url_for_key(organization)
  File "C:\Users\chkuech\.azure\cliextensions\azure-devops\azext_devops\dev\common\_credentials.py", line 85, in normalize_url_for_key
    organization_name = organization_name.split('/')[1]
IndexError: list index out of range

To open an issue, please visit: https://aka.ms/azcli/ext/issues

Also seems that the "packages" tag should be removed from this issue, as it occurs agnostic of "packages"

I agree, re-opening. I've personally heard a lot of feedback about --organization being super confusing due to both the URL format and the bad error message you get when specifying an organization name.

@chriskuech if you're still seeing issues with --path not accepting relative paths, that is a separate packaging specific issue that we should look into further. Could you please open a separate issue for that?

Duplicate of https://github.com/Azure/azure-devops-cli-extension/issues/429
But lets keep this open. I will take care of fixing it.

@chriskuech Error handling for organization is improved to handle accepting only URLs and not orgnames. Fix in 0.11.0 Release ETA: Next week.

As Zach said, if you're still seeing issues with --path not accepting relative paths, that is a separate packaging specific issue that we should look into further. Could you please open a separate issue for that?

I will close this issue once you confirm.

Nope, I'm not still having the relative path issue. The only remaining issue I'm having is the aforementioned list index out of range error happening agnostic of az artifacts

Thanks for the update.
Closing the issue, fix will be available in 0.11.0 in release next week.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JohannesDrexler picture JohannesDrexler  路  5Comments

bergmeister picture bergmeister  路  6Comments

atbagga picture atbagga  路  3Comments

atbagga picture atbagga  路  5Comments

lzybkr picture lzybkr  路  7Comments