Search code examples
azure-devopsdevopsazure-devops-rest-apiazure-devops-extensions

Is there a way to tell if user is the organization admin in azure devops extension api


Using the Azure Devops Extension API in an extension I'm building and wondering if there is an API available to tell if the current user is the organization admin so that we can hide/show different options for that user(s). Or is there another API that I can hit from my extension to get some extended details about the current user rather than what comes back with SDK.getUser()


Solution

  • You can get PCA members via the API below, and check whether the current user in PCA:

    GET https://vsaex.dev.azure.com/{organization}/_apis/GroupEntitlements/{groupId}/members?api-version=6.0-preview.1
    

    https://learn.microsoft.com/en-us/rest/api/azure/devops/memberentitlementmanagement/members/get?view=azure-devops-rest-6.0