Last active
February 20, 2021 16:03
-
-
Save dylanberry/cda9764c9d5f13eb1373c0745e59dded to your computer and use it in GitHub Desktop.
This file contains 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
$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