Rocky Kajla
Rocky Kajla

Reputation: 33

how to monitor adf pipeline from CI/CD pipeline

I have a CD Pipeline which triggers an azure data factory(adf) pipeline but it(CD pipeline) doesn't wait to proceed with next tasks until the(adf) pipeline completes. I wanna know that is there any inbuilt capabilities in CD pipeline through which i can trigger as well as monitor adf pipeline.

So, my desired outcome is that CD pipeline should wait for adf pipeline to complete before proceeding with next tasks in CD pipeline.

Upvotes: 3

Views: 915

Answers (1)

Simon Zeinstra
Simon Zeinstra

Reputation: 815

You can use the following Powershell script from Azure DevOps.

$resourceGroupName  = "yourresourcegroup"
$DataFactoryName    = "yourdatafactory"
$pipelineName       = "yourpipeline"
$pollFrequency      = 1

$executionId = Invoke-AzDataFactoryV2Pipeline -ResourceGroupName $resourceGroupName -DataFactoryName $DataFactoryName -PipelineName $pipelineName

$runStatus = (Get-AzDataFactoryV2PipelineRun -ResourceGroupName $resourceGroupName -DataFactoryName $DataFactoryName -PipelineRunId $executionId).Status
While ($runStatus -eq 'InProgress') {

    Write-Host ("Pipeline {0} in progress" -f $pipelineName)
    Start-Sleep $pollFrequency

    $runStatus = (Get-AzDataFactoryV2PipelineRun -ResourceGroupName $resourceGroupName -DataFactoryName $DataFactoryName -PipelineRunId $executionId).Status
}

Write-Host ("Pipeline {0} finished with status {1}" -f $pipelineName, $runStatus)

Upvotes: 4

Related Questions