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,523 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,712 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,419 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
800 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,315 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,321 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
829 views
0 votes
0 answers

Multiple YAML build pipelines in Azure DevOps

Using the new YAML way I want ...READ MORE

Mar 15, 2022 in DevOps Tools by Kichu
• 19,040 points
1,137 views
0 votes
0 answers

helm registry login --password-stdin in Azure DevOps pipeline

I am trying to log in to ...READ MORE

Mar 22, 2022 in DevOps Tools by Kichu
• 19,040 points
983 views
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,300 points
2,986 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,566 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