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,
        [Parameter(Mandatory = $true)]
        [string]$version
    )

    $appsList = [System.Collections.ArrayList]@()

    $output = az artifacts universal download --organization ("https://dev.azure.com/" + $devOpsOrganization) --feed "$devOpsFeed" --name "$devOpsArtifact" --version "$version" --path "$destination"
    if (!$output) {
        throw "Could not download package $devOpsArtifact from $devOpsOrganization feed $devOpsFeed"
    }

    $files = (Get-ChildItem $destination -Filter "*.app")
    foreach ($file in $files) {
        if (!$file.Name.StartsWith('Microsoft')) {
            if (!$appsList.contains($file.FullName)) {
                [void]$appsList.Add($file.FullName)
            }
        }
    }

    return $appsList
}
Export-ModuleMember Get-DevOpsArtifactsFromFeed