AzureArtifactDownloader/listArtifacts.ps1

16 lines
No EOL
837 B
PowerShell

function ListArtifacts {
Param (
[string]$token,
[string]$instance,
[string]$project,
[string]$buildId
)
Process {
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Basic $token")
$headers.Add("Cookie", "VstsSession=%7B%22PersistentSessionId%22%3A%22358fb34b-2e05-46fc-9452-287c2986ac02%22%2C%22PendingAuthenticationSessionId%22%3A%2200000000-0000-0000-0000-000000000000%22%2C%22CurrentAuthenticationSessionId%22%3A%2200000000-0000-0000-0000-000000000000%22%2C%22SignInState%22%3A%7B%7D%7D")
$url = "https://$instance/$project/_apis/build/builds/$buildId/artifacts?api-version=7.1-preview.5"
$response = Invoke-RestMethod $url -Method 'GET' -Headers $headers
return $response
}
}