Find PAT scope using azure DevOps rest api

0 votes

I'm working on a script that determines whether PAT has full scope or not.

In Microsoft Docs, I discovered the following information:

GET https://vssps.dev.azure.com/{organization}/_apis/tokenadmin/personalaccesstokens/{subjectDescriptor}?api-version=6.0-preview.1

I can find all the PATS and their names, as well as the scope and other details for a specific user, using this API.

I don't want to pass the PAT name into the script and then have to figure out what the scope is for it.

I'd like to utilise a PAT token and return the scope for that token.

Is there a way to do this with an API?

Feb 11 in DevOps Tools by Edureka
• 840 points
67 views

1 answer to this question.

0 votes

At this time, there is no way to return PAT scope using a PAT token rather than a PAT name.

Personal Access Tokens - List: The same as the REST API Personal Access Tokens - List:

{
        "clientId": "00000000-0000-0000-0000-000000000000",
        "accessId": "439729fa-be4e-49b2-8530-263cf053d786",
        "authorizationId": "a451306e-621d-4a6c-8c54-9096493a40f9",
        "hostAuthorizationId": "00000000-0000-0000-0000-000000000000",
        "userId": "c1b9603c-da3a-410e-9e59-074dcee61dcc",
        "validFrom": "2021-01-07T00:00:00",
        "validTo": "2021-02-06T00:00:00",
        "displayName": "TestPATA1",
        "scope": "app_token",
        "targetAccounts": [
            "c519b80d-5d71-46b3-a8e0-3edf8c026ea2"
        ],
        "token": null,
        "alternateToken": null,
        "isValid": true,
        "isPublic": false,
        "publicData": null,
        "source": null,
        "claims": null
    },

We could correlate the value of the PAT token with each PAT because the response body does not contain the value of the PAT token.

answered Feb 11 by Bhavitha
• 980 points

Related Questions In DevOps Tools

0 votes
1 answer
0 votes
1 answer

How to download the latest minor version of nexus artifact using REST?

If you're using nexus 2.x, you can ...READ MORE

answered Jun 27, 2018 in DevOps Tools by ajs3033
• 7,280 points
2,233 views
0 votes
1 answer

using custom tools in a Bluemix DevOps pipeline stage

When you create a new job, you ...READ MORE

answered Jul 25, 2018 in DevOps Tools by ajs3033
• 7,280 points
176 views
0 votes
1 answer

ERROR: Could not find a valid gem 'logstash-core-plugin-api' (>= 0) in any repository

Hi@akhtar, I think you don't have JRuby installed ...READ MORE

answered Jun 18, 2020 in DevOps Tools by MD
• 95,340 points
763 views
0 votes
0 answers

Azure DevOps Server - pause/resume all pipelines during maintenance window

Other systems are reliant on a build/release. ...READ MORE

Feb 8 in DevOps Tools by Edureka
• 840 points
113 views
0 votes
0 answers

Azure DevOps PDF Export Pulgin Suggestion

I built a job using Jenkin and ...READ MORE

Mar 15 in DevOps Tools by Kichu
• 15,250 points
18 views
0 votes
0 answers
0 votes
0 answers
0 votes
1 answer

running comands as non-root user while using docker-maven plugin

Docker needs root access therefore maven commands ...READ MORE

answered Apr 30, 2018 in DevOps Tools by ajs3033
• 7,280 points
1,782 views
0 votes
1 answer

How to use Azure DevOps server (TFS) Predefined Variable in My Ansible Playbook?

Simply add your variables to the azure-pipelines ...READ MORE

answered Feb 9 in DevOps Tools by Bhavitha
• 980 points
105 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP