In the release pipeline, I've a job which fetches multiple artifacts (previously built in Devops), listed here as A and B.
As a first step, I need to get the list of the artifact's name used in the current release. For this, I have some Powershell script that returns this.
Based on the API doc (https://docs.microsoft.com/en-us/rest/api/azure/devops/release/releases/get%20release?view=azure-devops-server-rest-5.0#artifact) it's supposed to return such info (version.id
)
$url = "<project URL>/_apis/release/releases/" + $releaseid + "?api-version=5.1"
$res = Invoke-RestMethod -Uri $url -Method Get -Headers @{ Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN" }
foreach ($a in $res.artifacts)
{
Write-Host "Artifact name: "$a.alias
Write-Host "Artifact version: "$a.version.id
}
This returns nothing in the version field:
Artifact name: test-scripts
Artifact version:
Artifact name: A
Artifact version:
Artifact name: B
Artifact version:
Any pointer on this much appreciated.