Just came across a task and had to do some digging to find the answer:
How to export Azure Synapse artifacts, more specifically pipelines, conserving their folder hierarchy, when Git integration is not available as an option, and not doing it through ARM templates.
Below is the solution found:
- On Azure Cloud Shell, with the following bash script:
1- on Azure cloud shell, with the following bash scritpt:
#!/bin/bash
WORKSPACE_NAME= "--YOUR-WORKSPACE-NAME--" # Change workspace name accordingly
OUTPUT_DIR="synapse_pipelines_export"
mkdir -p "$OUTPUT_DIR"
# get pipelines and respective folder location
pipeline_names=$(az synapse pipeline list \
--workspace-name "$WORKSPACE_NAME" \
--query "[].name" -o tsv)
pipeline_folders=$(az synapse pipeline list \
--workspace-name "$WORKSPACE_NAME" \
--query "[].folder.name" -o tsv)
# Read the output into arrays
readarray -t pipeline_names <<< "$pipeline_names"
readarray -t pipeline_folders <<< "$pipeline_folders"
for ((i=0; i<${#pipeline_names[@]}; i++)); do
mkdir -p "$OUTPUT_DIR/${pipeline_folders[i]}"
echo "Exporting Pipeline: ${pipeline_names[i]} into folder $OUTPUT_DIR/${pipeline_folders[i]}"
az synapse pipeline show \
--name "${pipeline_names[i]}" \
--workspace-name "$WORKSPACE_NAME" \
> "$OUTPUT_DIR/${pipeline_folders[i]}/${pipeline_names[i]}.json"
done
2- download zip file to local.