Skip to content

Instantly share code, notes, and snippets.

@deadlydog
Created October 10, 2025 20:33
Show Gist options
  • Select an option

  • Save deadlydog/2a47404253f67166c7927f437bac5ef0 to your computer and use it in GitHub Desktop.

Select an option

Save deadlydog/2a47404253f67166c7927f437bac5ef0 to your computer and use it in GitHub Desktop.
Test Azure DevOps Personal Access Token
# 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