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.
This is the script:
#Input Parameters
$ResourceGroupName = 'ABC'
$DataFactoryName = 'XYZ'
$before = (get-date).AddDays(1)
$after = (get-date).AddDays(-1)
#Get Pipeline Run History
$runIds = Get-AzDataFactoryV2PipelineRun -DataFactoryName $DataFactoryName -ResourceGroupName $ResourceGroupName -LastUpdatedAfter $after -LastUpdatedBefore $before
#Return all Retrieved Statuses
$runIds | ForEach-Object {
## Check for all statuses
Write-Host $_.Status
Write-Host $_.RunStart
Write-Host $_.RunEnd
Is this bug or am I missing anything here?
The code looks fine. I tested at my end it works fine. I would give it a shot by widening the timeframe.
Also, ensure the pipeline run is not getting completed before the execution of the script.