DevOpsHandling/Get-DevOpsArtifactsFromFeed.ps1
function Get-DevOpsArtifactsFromFeed { Param( [Parameter(Mandatory=$true)] [string]$devOpsOrganization, [Parameter(Mandatory=$true)] [string]$devOpsFeed, [Parameter(Mandatory=$true)] [string]$devOpsArtifact, [Parameter(Mandatory=$true)] [string]$devOpsToken, [Parameter(Mandatory=$true)] [string]$destination ) $appsList = [System.Collections.ArrayList]@() $org = ("https://dev.azure.com/" + $devOpsOrganization) $devOpsToken | az devops login --organization $org | ConvertFrom-Json $output = az artifacts universal download --organization $org --feed "$devOpsFeed" --name "$devOpsArtifact" --version * --path "$destination" if (!$output) { throw "Could not download package $devOpsArtifact from $devOpsOrganization feed $devOpsFeed" } $files = (Get-ChildItem $destination) foreach ($file in $files) { if (!$appsList.contains($file.FullName)) { [void]$appsList.Add($file.FullName) } } return $appsList } Export-ModuleMember Get-DevOpsArtifactsFromFeed |