-
-
Save johnlokerse/872c6369f67736d19f92e633ff8ebb9c 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
$Body = @{ | |
"PreviewRun" = "true" | |
"YamlOverride" = | |
' | |
pool: | |
vmImage: windows-2019 | |
jobs: | |
- job: Run_PowerShell_Write_Host | |
steps: | |
- task: PowerShell@2 | |
inputs: | |
targetType: "inline" | |
script: | | |
Write-Host "Hello World" | |
' | |
} | |
$OrganizationName = "john-lokerse" | |
$ProjectName = "Blog" | |
$PipelineId = 11 | |
$Url = "https://dev.azure.com/$OrganizationName/$ProjectName/_apis/pipelines/$PipelineId/runs?api-version=5.1-preview" | |
$Arguments = @{ | |
Method = "POST" | |
Uri = $Url | |
Body = $Body | ConvertTo-Json | |
ContentType = "application/json" | |
Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":<YOUR_PAT_HERE>")) } | |
} | |
Invoke-RestMethod @Arguments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment