1

I need to fetch the project administrators of each ADO project in my organization and prepare a report. I tried searching in MSDN documentation for Azure Rest API methods but unfortunately couldn't find any. Please advise.

2 Answers2

3

You could use Groups - List to get a list of all groups in the current scope (usually organization or account), and get Project Administrators groupID of each ADO project.

GET https://vssps.dev.azure.com/{organization}/_apis/graph/groups?api-version=5.1-preview.1

Then use Members - Get to get direct members of a Project Administrators Group:

GET https://vsaex.dev.azure.com/{organization}/_apis/GroupEntitlements/{groupId}/members?api-version=5.1-preview.1
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • Thank you for sharing this. I am able to fetch the individual users from Project Administrators but unable to get AAD groups under it. it is returning null. Below endpoint I am using to fetch the group "https://vsaex.dev.azure.com/{org}/_apis/GroupEntitlements/{groupId}?api-version=5.1-preview.1" – Dileep Palli Jun 12 '20 at 09:34
  • So your issue solved? If my reply helps you, you could [Accept it as an Answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work), this can be beneficial to other community members reading this thread. – Cece Dong - MSFT Jun 12 '20 at 09:38
  • accepted it but need guidance on fetching AAD group names under Administrators. Thanks a lot. – Dileep Palli Jun 12 '20 at 12:35
0

My way to get Projects Admins:
Fetch the link and get project id: GET https://dev.azure.com/{organization}/_apis/projects?$top=1000&api-version=7.0 result should be like this:

{
    "count": 10,
    "value": [
        {
            "id": "projectid",
            "name": "name",
            "description": "Something development project",
            "url": "https://dev.azure.com/{organization}/_apis/projects/{hash}",
            "state": "wellFormed",
            "revision": 51,
            "visibility": "private",
            "lastUpdateTime": "2022-06-02T10:15:46.157Z"
        }
    ]
}

next step: replace in body: projectid, organisation, project

POST: https://dev.azure.com/{organisation}/_apis/Contribution/HierarchyQuery

payload = {
"contributionIds":["ms.vss-admin-web.project-admin-overview-delay-load-data-provider"],
"dataProviderContext":{
    "properties":{"projectId":projectid,
    "sourcePage":{"url":https://dev.azure.com/{organisation}/{project}/_settings/,
    "routeValues":{
        "project":project
                }
            }
        }
    }
}

answer should be the next:

{
    "dataProviderSharedData": {},
    "dataProviders": {
        "ms.vss-web.component-data": {},
        "ms.vss-web.shared-data": null,
        "ms.vss-admin-web.project-admin-overview-delay-load-data-provider": {
            "projectAdmins": {
                "identities": [
                    {
                        "identityId": "identity",
                        "originId": "origin",
                        "subjectKind": "user",
                        "metaType": "member",
                        "displayName": "John Doe",
                        "mailAddress": "john.doe@example.com",
                        "descriptor": "descriptor",
                        "entityId": null,
                        "entityType": null,
                        "sid": null
                    }
                ],
                "totalIdentityCount": 3,
                "groupDescriptor": "vssgp.descriptor",
                "canAddMemberToAdminGroup": true,
                "collectionName": "organisation",
                "orgSettingsUrl": "https://dev.azure.com/organisation/_settings"
            },
            "defaultTeamId": "teamid"
        }
    }
}