microsoft / microsoft/azure-devops-python-api

Cannot get accounts list for a multi-organization access token

Offen
#473 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
684
Forks
218
Ø Merge
8 T. 10 Std.
Gemergte PRs (30 T.)
1

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Beispiel mit azure.devops.connection.Connection nachzustellen, rufe get_location_client() und get_accounts_client() auf und untersuche anschließend die ResourceAreas-Anfrage und den Pfad des accounts-Clients. Vergleiche die fehlschlagende Antwort mit dem dokumentierten Verhalten von Azure DevOps beim Auflisten von Konten. Die Aufgabe ist abgeschlossen, wenn festgestellt wurde, ob der Fehler auf der Dienstseite liegt oder ein unterstützter Client-/API-Pfad für Tokens mit mehreren Organisationen ermittelt wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
azure, python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.