Created
August 5, 2022 13:48
-
-
Save SQLvariant/5a74d8a6eac7267fc54c0bba9b2958ba to your computer and use it in GitHub Desktop.
A simple Find & Replace script for changing names of things withing Linked Service, Dataset, or Pipeline files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# Search for something inside an ADF file and replace it. #> | |
$Datasets = dir 'C:\temp\MDD-ADF-Test-Repo\dataset' -Recurse | |
foreach($Dataset in $Datasets.Where({$_.Mode -ne 'd----'})){ | |
$Dataset.Name | |
if((Get-Content $Dataset.FullName | foreach{ $_ -match 'AzureSqlDatabase1' }) -eq $true ){"Fix it" | |
(Get-Content $Dataset.FullName).Replace('Azure_SqlDatabase1', 'MDD_SampleSQL_LS') | Set-Content -Path $Dataset.FullName } | |
else{"Nothing to do"} | |
} | |
<# This isn't limited to just Datasets. you can go up one level and do the replace on every directory if you include the -Recurse parameter. #> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment