I am writing an automated test suite using powershell and the az cli. I need to be able to download the build pipeline artefacts from the last run of the pipeline to install and test the application. The problem is I need to know the run ID to be able to download the artefacts.
az pipelines runs artifact download --artifact-name "*Artifact Name*" --run-id **nnn** --path "c:\temp"
Is there anyway to find the last successful run ID? At present I look it up through the GUI so I know the download works as long as you use PublishPipelineArtifact and not PublishBuildArtifact due to a bug in the az cli.