Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dylanberry
Last active October 21, 2021 19:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylanberry/7c7c4e8746270fcee207981e5b0d9b10 to your computer and use it in GitHub Desktop.
Save dylanberry/7c7c4e8746270fcee207981e5b0d9b10 to your computer and use it in GitHub Desktop.
az login
$azureDevopsResourceId = "499b84ac-1321-427f-aa17-267ca6975798"
$token = az account get-access-token --resource $azureDevopsResourceId | ConvertFrom-Json
$authValue = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":" + $token.accessToken))
$headers = @{
Authorization = "Basic $authValue";
'X-VSS-ForceMsaPassThrough' = $true
}
$organization = "myorg"
$pipelineRunUrl = "https://dev.azure.com/$organization/_apis/projects"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri $pipelineRunUrl -Method GET -Headers $headers -ContentType 'application/json' -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment