Forum Discussion
Parameterize a data connection using copy data activity when extracting data from GBQ to Lakehouse
- Anonymous1 year ago
Hi sumanthkakarla,
Thank you for reaching out to the Microsoft Fabric Forum Community. Please try with below code and refine as per your requirements.
$filePath = "$(Build.SourcesDirectory)/Pipeline/pipeline1.json"
# Define the original and replacement connection strings
$original = "Test-w3prc4skt6eu3pib5o7d4pbqqm.datawarehouse.fabric.microsoft.com"
$replacement = "test.datawarehouse.fabric.microsoft.com"
# Check if file exists
if (Test-Path $filePath) {
$content = Get-Content $filePath -Raw
if ($content -like "*$original*") {
Write-Host "Found target string in $filePath. Replacing..."
$updated = $content -replace [Regex]::Escape($original), $replacement
Set-Content -Path $filePath -Value $updated
Write-Host "Replacement complete in $filePath"
}
else {
Write-Host "Target string not found. No changes made."
}
}
else {
Write-Error "File not found: $filePath"
}Please make sure to update the artifactId, workspaceId, and endpoint with the correct values according to your requirements if you are using the warehouse. For lakehouse deployments using the deployment pipelines in fabrics, the system will automatically point to the lakehouse in the target workspace if it has the same name.
Best regards,
Prasanna Kumar
Hi sumanthkakarla,
Just checking in to see if the suggested workaround using a PowerShell script in your DevOps pipeline helped with parameterizing the connection name in Fabric pipelines. Let me know if you need any further support or clarification.
Best regards,
Prasanna Kumar
Thank you Anonymous
Do you have any sample powershell script that i can use for this request ? i can refine it as per my requirement.
- Anonymous1 year agoNot applicable
Hi sumanthkakarla,
Thank you for reaching out to the Microsoft Fabric Forum Community. Please try with below code and refine as per your requirements.
$filePath = "$(Build.SourcesDirectory)/Pipeline/pipeline1.json"
# Define the original and replacement connection strings
$original = "Test-w3prc4skt6eu3pib5o7d4pbqqm.datawarehouse.fabric.microsoft.com"
$replacement = "test.datawarehouse.fabric.microsoft.com"
# Check if file exists
if (Test-Path $filePath) {
$content = Get-Content $filePath -Raw
if ($content -like "*$original*") {
Write-Host "Found target string in $filePath. Replacing..."
$updated = $content -replace [Regex]::Escape($original), $replacement
Set-Content -Path $filePath -Value $updated
Write-Host "Replacement complete in $filePath"
}
else {
Write-Host "Target string not found. No changes made."
}
}
else {
Write-Error "File not found: $filePath"
}Please make sure to update the artifactId, workspaceId, and endpoint with the correct values according to your requirements if you are using the warehouse. For lakehouse deployments using the deployment pipelines in fabrics, the system will automatically point to the lakehouse in the target workspace if it has the same name.
Best regards,
Prasanna Kumar