Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$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