Skip to content

Instantly share code, notes, and snippets.

@ArthurSteijn
Created February 7, 2021 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArthurSteijn/cb6cb7579765ef45f8485efc13269d25 to your computer and use it in GitHub Desktop.
Save ArthurSteijn/cb6cb7579765ef45f8485efc13269d25 to your computer and use it in GitHub Desktop.
# This PowerShell script triggers and monitors an Azure data factory pipeline outcome.
[CmdletBinding()]
param(
$resourceGroupName,
$dataFactoryName,
$DFPipelineName
)
$RunId = Invoke-AzDataFactoryV2Pipeline `
-DataFactoryName $DataFactoryName `
-ResourceGroupName $ResourceGroupName `
-PipelineName $DFPipeLineName
while ($True) {
$Run = Get-AzDataFactoryV2PipelineRun `
-ResourceGroupName $ResourceGroupName `
-DataFactoryName $DataFactoryName `
-PipelineRunId $RunId
if ($Run) {
if ($run.Status -eq 'Succeeded') {
Write-Output ("Pipeline run finished. The status is: " + $Run.Status)
$Run
break
}
if ($run.Status -eq 'Failed') {
Write-Error ("Pipeline run failed. " + $Run.Message )
$Run
break
}
Write-Output ("Pipeline is running...status: " + $Run.Status)
}
Start-Sleep -Seconds 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment