microsoft / microsoft/azure-devops-python-api

Cannot get accounts list for a multi-organization access token

Open
#473 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
684
Forks
218
Avg merge
8d 10h
Merged PRs (30d)
1

Description

Hello,

We have the following sample of code we use to list the accounts of a Token "accessible to all organizations". It was working until October 7th. After digging a little deeper into the library, it's trying to get the /_apis/ResourceAreas to presumably get the URLS to the accounts endpoint and calling it directly results in a 500 Internal error after 100 seconds with this payload

{
	"$id": "1",
	"innerException": null,
	"message": "The remote name could not be resolved: 'dpdbotprodwus30.dpdbot.visualstudio.com'",
	"typeName": "System.Net.Http.HttpRequestException, System.Net.Http",
	"typeKey": "HttpRequestException",
	"errorCode": 0,
	"eventId": 0
}

Sample code

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication

credentials = BasicAuthentication("", token)

connection = Connection(base_url="https://app.vssps.visualstudio.com", creds=credentials)

location_client = connection.clients_v6_0.get_location_client()
accounts_client = connection.clients_v6_0.get_accounts_client()

connection_data = location_client.get_connection_data()
authenticated_user = connection_data.authenticated_user

# This hangs
accounts = list(accounts_client.get_accounts(member_id=authenticated_user.id))

print(accounts)

Is there an issue on the Azure side ? Or perhaps a better way to get the list of accounts for a multi-org personal access token?

Thank you

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the sample with azure.devops.connection.Connection, get_location_client(), and get_accounts_client(), then inspect the ResourceAreas request and the accounts client path. Compare the failing response with the documented Azure DevOps account-listing behavior. Done means determining whether the failure is service-side or identifying a supported client/API path for multi-organization tokens.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.