Skip to content

Instantly share code, notes, and snippets.

@SQLvariant
Last active August 3, 2022 20:24
Show Gist options
  • Save SQLvariant/4e1bc0f5a83462c99518d07025255d66 to your computer and use it in GitHub Desktop.
Save SQLvariant/4e1bc0f5a83462c99518d07025255d66 to your computer and use it in GitHub Desktop.
This simple PowerShell script shows you how to copy activities from one ADF pipeline, and add those activities to another ADF pipeline.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<# # Copying Pipeline Activities
This simple PowerShell script shows you how to copy activities from one ADF pipeline, and add those activities to another ADF pipeline. #>
$DonorPipe = 'A'
$RecevingPipe = 'B'
$DonorPipelineContents = $null
$RecevingPipeline = $null
$DonorPipelineContents = Get-Content -Path ".\$DonorPipe.json" | ConvertFrom-Json -Depth 20
$RecevingPipeline = Get-Content -Path ".\$RecevingPipe.json" | ConvertFrom-Json -Depth 20
$RecevingPipeline.properties.activities.Count | SELECT @{label='ExistingPipelineActivitiesBefore';expression ={$_}} | fl
$RecevingPipeline.properties.activities += $DonorPipelineContents.properties.activities[4]
$RecevingPipeline.properties.activities += $DonorPipelineContents.properties.activities[5]
$RecevingPipeline.properties.activities.Count | SELECT @{Name='ExistingPipelineActivitiesAfter';expression ={$_}} | fl
$RecevingPipelineNewContents = $RecevingPipeline | ConvertTo-Json -Depth 20
Set-Content -Path ".\$RecevingPipe.json" -Value $RecevingPipelineNewContents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment