Created
October 10, 2025 20:33
-
-
Save deadlydog/2a47404253f67166c7927f437bac5ef0 to your computer and use it in GitHub Desktop.
Test Azure DevOps Personal Access Token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Fill in your AzDO PAT and Organziation name. | |
| # If you get a list of AzDO projects back, the PAT is valid; if you get some HTML saying you need to sign in, then it's not. | |
| $azureDevOpsPat = 'YOUR AZURE DEVOPS PAT GOES HERE' | |
| $azureDevOpsOrganization = 'YOUR AZURE DEVOPS ORG GOES HERE' | |
| $azureDevOpsEndpoint = "https://dev.azure.com/$azureDevOpsOrganization/_apis/projects?api-version=2.0" | |
| # Can use cURL with username/password authentication to see if you get results back. | |
| curl -u username:$azureDevOpsPat $azureDevOpsEndpoint | |
| # Or can use a basic auth token (PAT must be Base64 Encoded). | |
| $apiAuthToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$azureDevOpsPat")) | |
| Invoke-RestMethod -Uri $azureDevOpsEndpoint -Headers @{ | |
| Authorization = "Basic $apiAuthToken" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment