Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dylanberry/cda9764c9d5f13eb1373c0745e59dded to your computer and use it in GitHub Desktop.
Save dylanberry/cda9764c9d5f13eb1373c0745e59dded to your computer and use it in GitHub Desktop.
$AzureDevOpsOrganization = "myorg"
$AzureDevOpsProject = "myproject"
$PAT = "<Azure DevOps Personal Access Token>"
$devopsProjectUrl = "https://dev.azure.com/$AzureDevOpsOrganization/$AzureDevOpsProject"
$headers = @{
Authorization = "Basic $PAT";
'X-VSS-ForceMsaPassThrough' = $true
}
$body = @{
templateParameters = @{foo = "bar"}
}
$json = $body | ConvertTo-Json
$pipelineRunUrl = "$devopsProjectUrl/_apis/pipelines/$pipelineId/runs?api-version=6.0-preview.1"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$pipelineRunResponse = Invoke-RestMethod -Uri $pipelineRunUrl `
-Method POST -Headers $headers -ContentType 'application/json' `
-Body $json -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment