Skip to content

Instantly share code, notes, and snippets.

@SQLvariant
Last active August 3, 2022 20:24
This simple PowerShell script shows you how to copy activities from one ADF pipeline, and add those activities to another ADF pipeline.
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