Why Get-AzDataFactoryV2PipelineRun doesn't return InProgress pipeline?

44 Views Asked by At

I am running Azure Function App with the following PowerShell script to get ADF pipeline runs. It is returning all history of pipeline runs, but it is skipping the Active( In Process) run. It is returning Completed/Failed/Cancelled runs only. Microsoft Documentation shows that it should also return InProgress status as well. I triggered the ADF and made sure that it is running and this script only returned runs starting from the last completed run and previous runs, but completely ignored Active/InProgress run.

1

There are 1 best solutions below

0
Bhavani On

You can use below PowerShell script to get the pipeline state.

$ResourceGroupName = '<resourceGroupName>'
$DataFactoryName = '<adfName>'
$before = (Get-Date).AddDays(1)
$after = (Get-Date).AddDays(-1)
$runIds = Get-AzDataFactoryV2PipelineRun -DataFactoryName $DataFactoryName -ResourceGroupName $ResourceGroupName -LastUpdatedAfter $after -LastUpdatedBefore $before

$runIds | ForEach-Object {
    # Check for all statuses
    Write-Host $_.Status
    Write-Host $_.RunStart
    Write-Host $_.RunEnd
}

For InProgress state pipelines you will get null as value for RunEnd. Ensure the pipeline run is not getting completed before the execution of the script. For more information you can refer this.