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, 2022 in DevOps Tools by Edureka
• 850 points
1,533 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, 2022 by Bhavitha
• 1,000 points

Related Questions In DevOps Tools

0 votes
1 answer

How to Replicate the Artifacts between two Jfrog Artifactories by using CURL or jfrog rt (Rest API)

Yes and no, It's a bit complex ...READ MORE

answered Mar 27, 2018 in DevOps Tools by Atul
• 10,240 points
1,765 views
0 votes
0 answers

Why does Git keep asking for my password when using Azure DevOps, and how can I fix it?

Why does Git keep asking for my ...READ MORE

6 days ago in DevOps Tools by Anila
• 5,040 points
29 views
0 votes
0 answers

Are Azure DevOps REST APIs language-agnostic, and how can I use them in different programming environments?

Are Azure DevOps REST APIs language-agnostic, and ...READ MORE

3 days ago in DevOps Tools by Anila
• 5,040 points
28 views
0 votes
0 answers

What are the challenges with using Git submodules in Azure DevOps, and how can they be mitigated?

What are the challenges with using Git ...READ MORE

2 days ago in DevOps Tools by Anila
• 5,040 points
21 views
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,300 points
3,438 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,300 points
811 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,460 points
2,361 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, 2022 in DevOps Tools by Edureka
• 850 points
2,342 views
0 votes
0 answers

Azure DevOps PDF Export Pulgin Suggestion

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

Mar 15, 2022 in DevOps Tools by Kichu
• 19,040 points
844 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, 2022 in DevOps Tools by Bhavitha
• 1,000 points
1,593 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP