azure data factory logs for powershell calls

90 Views Asked by At

We have a powershell script running our ADF pipelines. To check the status of the pipeline run we use Get-AzDataFactoryV2PipelineRun. Unfortunately occasionally this command just hangs and never returns a response. We're trying to get to the bottom of why this would be the case.

Is there a way of seeing the events that powershell calls make to ADF in the analytics logs of ADF so we can see if there is any further useful information?

Regards

1

There are 1 best solutions below

0
Bhavani On

You can use the PowerShell script below to get the status of a pipeline in ADF:

$RunId = Invoke-AzDataFactoryV2Pipeline `
  -DataFactoryName "<dataFactoryName>" `
  -ResourceGroupName "<resourceGroupName>" `
  -PipelineName "<pipelineName>"

while ($True) {
    $Run = Get-AzDataFactoryV2PipelineRun `
        -ResourceGroupName "<resourceGroupName>" `
        -DataFactoryName "<dataFactoryName>" `
        -PipelineRunId $RunId

    if ($Run) {
        if ($run.Status -ne 'InProgress') {
            Write-Output ("Pipeline run finished. The status is: " +  $Run.Status)
            $Run
            break
        }
        Write-Output "Pipeline is running...status: InProgress"
    }

    Start-Sleep -Seconds 10
}

This will give the status of the pipeline as below:

Pipeline run finished. The status is: Succeeded

ResourceGroupName : <resourceGroupName>
DataFactoryName   : <dataFactoryName>
RunId             : <runId>
PipelineName      : <pipelineName>
RunGroupId        : <resourceGroupId>
IsLatest          : True
InvokedBy         : Microsoft.Azure.Management.DataFactory.Models.PipelineRunInvokedBy
LastUpdated       : 2/22/2024 8:15:22 AM
Parameters        : {}
RunStart          : 2/22/2024 8:15:20 AM
RunEnd            : 2/22/2024 8:15:22 AM
DurationInMs      : 1962
Status            : Succeeded
Message           :

enter image description here