Open JJKW1984 opened 1 year ago
@StartAutomating Do you if this is me doing something wrong or if it is a real bug?
@JJKW1984 It's neither. It's just that Azure DevOps is a bit of a punk when it comes to API naming.
Teams are a concept that is truly locked down to a specific, well, team.
All Teams are implicitly users in their own right.
So you can see all of the users and teams throughout an org with Get-ADOUser, not Get-ADOTeam, because that's what the underlying apis support.
Get-ADOUser -Organization $myOrg should give you all of the users.
I'm sorry this part of Azure DevOps is so wonky.
It took me a while to figure out, too.
Let me know if you need any more help.
@StartAutomating That is strange. I agree the DevOps API is wonky. You made a good point in your last video - Microsoft should use openapi. But alas, company priorities. I'm still trying to learn this code base and match our implementation to this much better version. Thanks for all your work!
I think teams as part of the core API has its own end points: https://learn.microsoft.com/en-us/rest/api/azure/devops/core/teams?view=azure-devops-rest-5.1
When I use get-ADOTeams and it indeed returns what would be expected but hits a max return size.
When I wrote a part of our internal VSTSLibrary and I ended up using this sloppy solution: https://dev.azure.com/$org/_apis/teams?$top=5000 which returns all the teams vs the normal return which is think is something like 200.
I don't see how to grab all teams via Get-ADOUser.
Ah.
It does look like that API is covered.
It appears to be the default parameter set of Get-ADOTeam.
I wonder, are you using Connect-ADO with a -Project?
I couldn't find a call the core teams api just the projects/api. What line number is that in get-adoteams?
I don't see a -project parm on the connect-ado command.
I am doing:
connect-ADO -Organization $org -PersonalAccessToken (Get-Content .\pat.txt)
`$teams = Get-ADOTeam'
This which returns all the correct data but only the first 100 of the 3500 or so teams.
Hmm.
This may be a pagination issue then. This is another thing Azure DevOps does inconsistently.
Could you try using Invoke-ADORestApi to call the api directly (providing $top=100&$skip=0
)?
It appears this command doesn't get all teams available in the organization which is a different API. https://learn.microsoft.com/en-us/rest/api/azure/devops/core/teams/get-all-teams?view=azure-devops-rest-7.0&tabs=HTTP
It also only lists a small group of teams inside a specific project, and I don't see a way to indicate top or skip params: https://learn.microsoft.com/en-us/rest/api/azure/devops/core/teams/get-teams?view=azure-devops-rest-7.0&tabs=HTTP