Generated banner for Pipeline Migration
Generated logo for Pipeline Migration

Pipeline Migration

MicrosoftOfficialPublished by Microsoft

  • Skill
  • Workflow
  • Cloud and DevOps
  • MIT
  • No issues found

From the author

Migrates Synapse Data Factory pipelines to Fabric Data Factory, turning linked services into Fabric connections, inlining datasets into activities, converting global parameters to Variable Libraries, and mapping SynapseNotebook to TridentNotebook. Use for pipeline JSON. For Synapse Spark notebook code use synapse-migration.
— the description by Microsoft

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured, API-driven workflow for migrating Synapse Data Factory pipelines to Microsoft Fabric. It handles the transformation of pipeline JSON, including inlining datasets, converting linked services to Fabric connections, mapping SynapseNotebook activities to TridentNotebook, and migrating global parameters to Variable Libraries. The skill includes assessment, orchestration, and validation phases to ensure a smooth transition, while identifying unsupported activities that require manual intervention.

What it does

  • Assesses Synapse pipeline complexity and migration scope.
  • Automates the conversion of Synapse pipeline JSON to Fabric DataPipeline format.
  • Inlines dataset definitions directly into pipeline activities.
  • Maps Synapse linked services to Fabric connections.
  • Converts global parameters into Fabric Variable Library items.
  • Updates notebook activities to reference Fabric notebook GUIDs.

When to use it

  • When migrating existing Synapse Data Factory pipelines to Microsoft Fabric.
  • To assess the feasibility and blockers of a pipeline migration project.
  • When you need to convert Synapse global parameters to Fabric Variable Libraries.
  • When you need to update notebook activity references for the Fabric environment.

Advantages

  • Reduces manual effort by automating JSON transformations and API calls.
  • Provides a clear, phased approach to migration with built-in assessment.
  • Ensures compatibility by mapping deprecated Synapse features to Fabric equivalents.
  • Reduces errors by automating GUID lookups and connection references.

Usage examples

“Assess my Synapse workspace 'FinancePipelineWS' for migration to Fabric.”
The agent will query the Synapse workspace, analyze the pipelines, and generate a markdown report detailing the migration scope, potential blockers, and unsupported activities.
“Migrate all pipelines from Synapse workspace 'FinancePipelineWS' to Fabric workspace 'FinanceFabricWS'.”
The agent will orchestrate the migration, including creating connections, converting parameters, updating notebook references, and deploying the new pipelines to Fabric.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/microsoft/pipeline-migration/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip pipeline-migration.zip -d .agents/skills

Documentation by Microsoft

Telemetry — MANDATORY. Every api.fabric.microsoft.com call must carry x-ms-fabric-skill: pipeline-migration (az rest: --headers "x-ms-fabric-skill=pipeline-migration"), including every LRO poll, fabric_lro and retry. Snippets omit it — add it anyway.

CRITICAL NOTES

  1. To find workspace details (including its ID) from a workspace name: list all workspaces, then use JMESPath filtering

  2. To find item details (including its ID) from workspace ID, item type, and item name: list all items of that type in that workspace, then use JMESPath filtering

  3. Fabric does NOT have a "Dataset" item type — all dataset properties are inlined into activity typeProperties

  4. Linked Services map to Fabric Connections — in pipeline activity JSON, referenceName on the activity's linkedService block uses the Fabric connection display name (not the connection GUID); the connection GUID is used only on Fabric REST API calls

  5. Notebook activities change from SynapseNotebook to TridentNotebook and reference notebooks by GUID, not by name

  6. Synapse global parameters become a Variable Library item in Fabric, referenced as @pipeline().libraryVariables.<name>. Variable Library Number types are not consumable in pipelines — Synapse Float/Double are mapped to String for runtime compatibility

  7. The Validation activity type does not exist in Fabric — it must be rewritten as GetMetadata + IfCondition

  8. Triggers are intentionally excluded from this skill — recreate schedules manually in Fabric after migration

  9. SSIS package execution, SHIR-exclusive connectors, and Databricks activities are parked — see pipeline-gotchas.md

Synapse Pipelines → Microsoft Fabric Data Factory Migration

Prerequisite Knowledge

These companion documents provide general Fabric REST patterns. Do NOT read them upfront — reference only when a specific phase requires a pattern not already covered in this skill's resource files:

  • COMMON-CORE.md — General Fabric REST API patterns, authentication & token audiences, item discovery via JMESPath

  • COMMON-CLI.md — az rest / az login CLI patterns, authentication recipes, pipeline run/schedule operations

  • ITEM-DEFINITIONS-CORE.md — DataPipeline and VariableLibrary item definition structures (pipeline-content.json, variables.json)

  • SPARK-AUTHORING-CORE.md — Fabric notebook item creation (needed when notebook items don't exist yet in Fabric)

For the notebook side of the migration (the notebooks that pipeline activities call), use the companion synapse-migration skill to migrate the notebook content itself.


Table of Contents

TopicReference
Pre-Migration Assessment (run first)pipeline-assessment.md
Migration Orchestratorpipeline-orchestrator.md
API-Driven Migration Workflow§ API-Driven Migration Workflow
Activity Type Mappingactivity-mapping.md
Notebook Activity Migration (primary focus)notebook-activity-migration.md
Linked Services → Connectionslinked-service-to-connection.md
Dataset Inliningdataset-inlining.md
Global Parameters → Variable Libraryglobal-parameters-to-variable-library.md
Pipeline Gotchas & Parked Activitiespipeline-gotchas.md
Validation & Testingvalidation-testing.md
Migration Reportmigration-report.md
Context Loading Guide

IMPORTANT — Load only what you need. Do NOT read all resource files upfront.

WhenRead This File
User asks for an assessment, scope, or plan before migratingpipeline-assessment.md
User asks to migrate a full pipeline workspacepipeline-orchestrator.md
User asks about activity type mapping or unsupported activitiesactivity-mapping.md
User has SynapseNotebook activities (most common)notebook-activity-migration.md
User asks about linked services or connectionslinked-service-to-connection.md
User asks about Copy, Lookup, or GetMetadata with datasetsdataset-inlining.md
User has global parameters to convertglobal-parameters-to-variable-library.md
User hits SSIS, SHIR, Databricks, or other blockerspipeline-gotchas.md
Post-migration verificationvalidation-testing.md
Generating a migration summarymigration-report.md

API-Driven Migration Workflow

Authentication
TargetToken Audience
Synapse Data Plane (pipelines, datasets, linked services)https://dev.azuresynapse.net
Synapse ARM (global parameters, workspace properties)https://management.azure.com
Fabric REST API (create pipelines, connections, Variable Libraries)https://api.fabric.microsoft.com

Use az account get-access-token --resource <audience> --query accessToken -o tsv to acquire tokens.

Synapse Data-Plane API Reference
OperationEndpoint
List all pipelinesGET https://{ws}.dev.azuresynapse.net/pipelines?api-version=2020-12-01
Get pipeline definitionGET https://{ws}.dev.azuresynapse.net/pipelines/{name}?api-version=2020-12-01
List all datasetsGET https://{ws}.dev.azuresynapse.net/datasets?api-version=2020-12-01
Get dataset definitionGET https://{ws}.dev.azuresynapse.net/datasets/{name}?api-version=2020-12-01
List all linked servicesGET https://{ws}.dev.azuresynapse.net/linkedservices?api-version=2020-12-01
Get linked serviceGET https://{ws}.dev.azuresynapse.net/linkedservices/{name}?api-version=2020-12-01
Get workspace (global parameters)GET https://management.azure.com/subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.Synapse/workspaces/{ws}?api-version=2021-06-01
Fabric API Reference
OperationEndpoint
List connectionsGET https://api.fabric.microsoft.com/v1/connections
Create connectionPOST https://api.fabric.microsoft.com/v1/connections
Create pipeline itemPOST https://api.fabric.microsoft.com/v1/workspaces/{wsId}/items
Update pipeline definitionPOST https://api.fabric.microsoft.com/v1/workspaces/{wsId}/items/{id}/updateDefinition
Get pipeline definitionPOST https://api.fabric.microsoft.com/v1/workspaces/{wsId}/items/{id}/getDefinition
Create Variable LibraryPOST https://api.fabric.microsoft.com/v1/workspaces/{wsId}/items (type: VariableLibrary)
List notebooks in workspaceGET https://api.fabric.microsoft.com/v1/workspaces/{wsId}/notebooks

Before creating any items in Fabric, run the pipeline assessment to understand scope, complexity, and blockers. The assessment is read-only — it queries Synapse APIs only and produces a markdown report.

Copilot workflow — no Python script file needed:

  1. Ask the user: "What is the name of your Synapse workspace?"

  2. Auto-discover subscription ID and resource group via az account show and az synapse workspace show

  3. Run the assessment code inline from the terminal

  4. Print the full report output directly in the chat

When to UseAction
User wants to understand migration scope before committingAsk for workspace name → load pipeline-assessment.md → run inline
User asks "what will and won't migrate?"Run assessment, present the Executive Summary section
User asks for a migration plan or scoping documentRun assessment, print report in chat
User has already decided to migrateSkip assessment — go straight to Migration Phases below

To also save the report to disk, pass output_path=f"pipeline-assessment-{SYNAPSE_WS}.md" to generate_assessment_report(). The PipelineAssessment objects it produces feed directly into the migration scripts in pipeline-orchestrator.md.


Migration Mode (Inline — No Script File Required)

Copilot performs the migration directly from the terminal. No Python files to save or run manually.

Ask the user for:

  1. Synapse workspace name (reuse from assessment if already run)

  2. Fabric workspace name

  3. Which pipelines to migrate — specific names, or * for all

  4. Optional name suffix to append to each pipeline in Fabric (e.g. _migrated) — leave blank to keep the original name

Everything else is auto-discovered:

  • Subscription ID and resource group via az account show + az synapse workspace show

  • Fabric workspace ID via GET /v1/workspaces filtered by display name

  • Notebook GUIDs in Fabric via GET /v1/workspaces/{wsId}/notebooks (required for SynapseNotebook → TridentNotebook)

  • Connection names in Fabric via GET /v1/connections (when datasets reference linked services)

What is fully automated inline:

  • ✅ SynapseNotebook → TridentNotebook — type rename, GUID lookup, remove sparkPool/sessionConfiguration, fix timeout to 12h max

  • ✅ All compatible activity types — pass through with minor property adjustments

  • ✅ Dataset inlining into activity typeProperties

  • ✅ Global parameter expressions rewritten to @pipeline().libraryVariables.<name>

  • ✅ Pipeline JSON assembly and deployment to Fabric via REST

Copilot checks before starting — will pause and report if:

  • A notebook referenced by a SynapseNotebook activity does not exist in the Fabric workspace yet

  • A Fabric Connection is missing for a linked service referenced by dataset activities

Load pipeline-orchestrator.md for the complete inline runner.


Migration Phases (Execute in Order)

PhaseSourceTargetResource
Phase 0Synapse notebooks (referenced by pipeline activities)Fabric Notebookssynapse-migration skill
Phase 1Synapse global parametersFabric Variable Libraryglobal-parameters-to-variable-library.md
Phase 2Synapse linked servicesFabric Connectionslinked-service-to-connection.md
Phase 3Synapse datasetsInlined into activitiesdataset-inlining.md
Phase 4Synapse pipeline activitiesFabric pipeline activitiesactivity-mapping.md + notebook-activity-migration.md
Phase 5Assembled pipeline JSONFabric DataPipeline itempipeline-orchestrator.md
Final—Validationvalidation-testing.md

Phase 0 must precede Phase 4: Fabric Notebook GUIDs are needed before TridentNotebook activities can be written. Phase 2 must precede Phase 3: Connection names must exist before they can be referenced in inlined datasets.


Activity Type Quick Reference

Full mapping table, before/after examples, and parking decisions are in activity-mapping.md.

Synapse ActivityFabric EquivalentStatus
SynapseNotebookTridentNotebook✅ Migrated — see notebook-activity-migration.md
CopyCopy✅ Migrated — datasets inlined
LookupLookup✅ Migrated — datasets inlined
GetMetadataGetMetadata✅ Migrated — datasets inlined
ValidationGetMetadata + IfCondition✅ Migrated — split into 2 activities
ForEachForEach✅ Compatible
IfConditionIfCondition✅ Compatible
SwitchSwitch✅ Compatible
UntilUntil✅ Compatible
WaitWait✅ Compatible
FailFail✅ Compatible
SetVariableSetVariable✅ Compatible
AppendVariableAppendVariable✅ Compatible
ExecutePipelineExecutePipeline✅ Compatible — add workspaceId
WebActivityWebActivity✅ Compatible
ScriptScript✅ Compatible — update connection refs
DeleteDelete✅ Migrated — datasets inlined
FilterFilter✅ Compatible
SparkJobDefinition (Synapse SJD)SparkJobDefinition✅ Update GUID refs
HDInsightSparkTridentNotebook or SparkJobDefinition⚠️ Rewrite required
AzureMLBatchExecutionWebActivity⚠️ Rewrite as REST call
AzureFunctionActivityWebActivity⚠️ Rewrite — use function URL + key
DatabricksNotebook⛔ ParkedSee pipeline-gotchas.md
DatabricksSparkJar⛔ ParkedSee pipeline-gotchas.md
DatabricksSparkPython⛔ ParkedSee pipeline-gotchas.md
ExecuteSSISPackage⛔ ParkedSee pipeline-gotchas.md
AzureBatch⛔ ParkedNo Fabric equivalent
Custom⛔ ParkedNo Fabric equivalent

Must / Prefer / Avoid

MUST DO
  • Migrate notebooks before pipelines — Fabric TridentNotebook activities require notebook GUIDs, not names. Use the synapse-migration skill first

  • Create Fabric Connections before building pipeline JSON — linked service names in Synapse become connection references in Fabric; you need the connection names before inlining datasets

  • Inline all dataset definitions — Fabric Data Factory has no Dataset item type; all inputs/outputs dataset properties must be embedded in each activity

  • Replace @pipeline().globalParameters.<name> with @pipeline().libraryVariables.<name> after creating the Variable Library

  • Replace Validation activities with a GetMetadata + IfCondition pair — Validation does not exist as an activity type in Fabric

  • Remove sparkPool and sessionConfiguration from migrated notebook activities — pool selection and session config belong in the Fabric Environment attached to the notebook

PREFER
  • Variable Library with Value Sets for dev/test/prod environments — use @pipeline().libraryVariables.<name> with environment-specific Value Sets instead of pipeline-level parameters for environment promotion

  • Parameterized notebookParameters over hardcoded values in TridentNotebook activities — mirrors Synapse parameterized notebook pattern

  • Test notebook activities individually before running the full migrated pipeline — notebook GUIDs are the most common source of failure

  • OneLake Lakehouse sources/sinks for Copy activities where applicable — eliminates the need for external connections for data already in OneLake

AVOID
  • Do not reference notebooks by name in TridentNotebook activities — use the GUID from the Fabric workspace notebook list

  • Do not carry over Synapse triggers — they are not migrated by this skill; recreate schedules in Fabric after validating the pipeline

  • Do not attempt to migrate SSIS, Databricks, or AzureBatch activities without reading pipeline-gotchas.md first — these require manual intervention

  • Do not hardcode workspace/item GUIDs in pipeline JSON — use Variable Library entries or pipeline parameters so environments can be promoted without editing pipeline JSON

  • Do not use @pipeline().globalParameters syntax after migration — this expression path does not exist in Fabric; all migrated global parameters must be accessed via @pipeline().libraryVariables


Migration Gotchas — Quick Reference

Full troubleshooting guide is in pipeline-gotchas.md.

#Flag IDIssueSeverityResolution Summary
PG1NOTEBOOK_GUID_NOT_FOUNDNotebook not yet migrated to Fabric when building TridentNotebook activityHighRun synapse-migration skill first; get GUID from GET /v1/workspaces/{wsId}/notebooks
PG2DATASET_NOT_INLINEDActivity still references a named dataset (not valid in Fabric)HighApply dataset-inlining.md patterns to embed dataset properties into activity source/sink
PG3GLOBAL_PARAM_EXPRESSION@pipeline().globalParameters.<name> expression left in migrated pipelineHighReplace with @pipeline().libraryVariables.<name> after creating Variable Library
PG4VALIDATION_ACTIVITY_UNSUPPORTEDValidation activity type left in pipeline JSONHighRewrite as GetMetadata + IfCondition — see activity-mapping.md
PG5SHIR_CONNECTOR_PARKEDActivity uses a linked service backed by a Self-Hosted Integration RuntimeMediumMust set up on-premises data gateway in Fabric; see pipeline-gotchas.md
PG6SSIS_ACTIVITY_PARKEDExecuteSSISPackage activity cannot be migratedHighParked — no Fabric equivalent; see pipeline-gotchas.md for alternatives
PG7DATABRICKS_ACTIVITY_PARKEDDatabricks activity type has no Fabric native equivalentHighParked — use Databricks REST API via WebActivity as workaround; see pipeline-gotchas.md
PG8SPARKPOOL_REF_ORPHANEDsparkPool / targetBigDataPool reference left in TridentNotebook activityMediumRemove sparkPool and sessionConfiguration blocks; pool config belongs in Fabric Environment
PG9EXECUTE_PIPELINE_NO_WORKSPACEExecutePipeline activity missing workspaceId for referenced pipelineMediumAdd workspaceId to typeProperties; required even for same-workspace child pipelines — omitting it causes runtime failures
PG10LINKED_SERVICE_NO_CONNECTIONLinked service has no matching Fabric ConnectionHighCreate connection manually or via API; update connection reference in inlined dataset

Post-Migration: What's Next

After pipeline migration, hand off to these companion skills and tools:

TaskSkill / Tool
Migrate notebook content (mssparkutils → notebookutils, linked services)synapse-migration skill
Schedule migrated pipelinesCOMMON-CLI.md § Job Scheduling
Monitor pipeline runsFabric workspace → Monitor hub
Build new Fabric pipelinesRefer to ITEM-DEFINITIONS-CORE.md § DataPipeline
Explore migrated Lakehouse data post-pipeline runspark-cli or sqldw-cli skill

Examples

SynapseNotebook → TridentNotebook activity (before/after)

{
  "name": "Run_Notebook",
  "type": "SynapseNotebook",
  "typeProperties": {
    "notebook": {"referenceName": "MyNotebook", "type": "NotebookReference"},
    "sparkPool": {"referenceName": "BigPool", "type": "BigDataPoolReference"}
  }
}

After migration (GUID from GET /v1/workspaces/{wsId}/notebooks):

{
  "name": "Run_Notebook",
  "type": "TridentNotebook",
  "typeProperties": {
    "notebookId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "workspaceId": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
  }
}

Global parameter expression rewrite

Before (Synapse):  @pipeline().globalParameters.batchDate
After (Fabric):    @pipeline().libraryVariables.batchDate

Dataset inlining: Copy activity — dataset reference → connection display name

Synapse dataset InputBlobDataset (will be inlined and removed):

{
  "type": "AzureBlob",
  "linkedServiceName": {"referenceName": "AzureBlobLinkedService"},
  "typeProperties": {"folderPath": "input/", "fileName": "data.csv"}
}

Synapse Copy activity (before — references dataset by name):

{
  "name": "CopyData", "type": "Copy",
  "inputs": [{"referenceName": "InputBlobDataset", "type": "DatasetReference"}],
  "typeProperties": {"source": {"type": "BlobSource"}, "sink": {"type": "BlobSink"}}
}

After migration (connection display name for AzureBlobLinkedService is My ADLS Connection):

{
  "name": "CopyData", "type": "Copy",
  "typeProperties": {
    "source": {"type": "BlobSource", "storeSettings": {"type": "AzureBlobStorageReadSettings"}},
    "sink":   {"type": "BlobSink",   "storeSettings": {"type": "AzureBlobStorageWriteSettings"}}
  },
  "linkedService": {"referenceName": "My ADLS Connection", "type": "LinkedServiceReference"}
}

See activity-mapping.md and notebook-activity-migration.md for full before/after examples.

Files

resources/global-parameters-to-variable-library.md

Global Parameters → Variable Library

Synapse Analytics global parameters are workspace-level key-value settings accessible by all pipelines via @pipeline().globalParameters.<name>. Fabric replaces this concept with the Variable Library item type — a workspace-level collection of typed variables with optional environment-specific value sets.


Concept Mapping

SynapseFabric
Global parameters (workspace-level setting)Variable Library (workspace item, type VariableLibrary)
@pipeline().globalParameters.<name> expression@pipeline().libraryVariables.<name> expression
Single set of values (no environments)Value Sets — one per environment (default + dev/test/prod overrides)
Types: String, Int, Float, Bool, Array, Object (capitalized in ARM response)Types: String, Integer, Number, Boolean (no array/object — workaround: JSON string)

Type Mapping

Synapse global parameter type values are capitalized in the ARM response (String, Int, Bool, Array, etc.) — match the casing in the ARM API example below. The conversion script's TYPE_MAP keys use this canonical capitalized form.

Synapse Type (ARM)Fabric Variable Library TypeNotes
StringStringDirect
IntIntegerDirect
Float / DoubleNumberDirect
BoolBooleanDirect
ArrayStringSerialize as JSON string: '["a","b","c"]'
ObjectStringSerialize as JSON string: '{"key":"value"}'

Downstream code that reads an Array/Object global parameter must json.loads() the string value. If the pipeline used @pipeline().globalParameters.myArray[0], this expression must change — see pipeline-gotchas.md § PG9.


Getting Synapse Global Parameters via ARM API

Global parameters are stored at the ARM resource level, not the Synapse data-plane API. Use the ARM token:

ARM_TOKEN="<arm-management-token>"
SUBSCRIPTION_ID="<subscription-id>"
RESOURCE_GROUP="<resource-group>"
SYNAPSE_WORKSPACE="<synapse-workspace-name>"

az rest --method GET \
  --headers "Authorization=Bearer ${ARM_TOKEN}" \
  --url "https://management.azure.com/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Synapse/workspaces/${SYNAPSE_WORKSPACE}?api-version=2021-06-01" \
  --query "properties.globalParameters" -o json

Example response:

{
  "environmentName": {
    "type": "String",
    "value": "production"
  },
  "maxBatchSize": {
    "type": "Int",
    "value": 500
  },
  "enableDebugLogging": {
    "type": "Bool",
    "value": false
  },
  "storageAccountName": {
    "type": "String",
    "value": "mystorage"
  },
  "allowedRegions": {
    "type": "Array",
    "value": ["eastus", "westus2"]
  }
}

Fabric Variable Library Structure

A Variable Library item consists of three definition parts:

1. variables.json — Variable declarations
{
  "schema": "https://developer.microsoft.com/json-schemas/fabric/item/variablelibrary/definitionFiles/variables/1.0.0/schema.json#",
  "variables": [
    {
      "name": "environmentName",
      "type": "String",
      "defaultValue": "production"
    },
    {
      "name": "maxBatchSize",
      "type": "Integer",
      "defaultValue": 500
    },
    {
      "name": "enableDebugLogging",
      "type": "Boolean",
      "defaultValue": false
    },
    {
      "name": "storageAccountName",
      "type": "String",
      "defaultValue": "mystorage"
    },
    {
      "name": "allowedRegions",
      "type": "String",
      "defaultValue": "[\"eastus\",\"westus2\"]",
      "description": "Serialized JSON array — use json() expression to parse"
    }
  ]
}
2. settings.json — Value set ordering
{
  "schema": "https://developer.microsoft.com/json-schemas/fabric/item/variablelibrary/definitionFiles/settings/1.0.0/schema.json#",
  "valueSetsOrder": ["default", "dev", "test", "prod"]
}
3. valueSets/default.json — Default values (mirrors variables.json defaults)
{
  "schema": "https://developer.microsoft.com/json-schemas/fabric/item/variablelibrary/definitionFiles/valueSets/1.0.0/schema.json#",
  "name": "default",
  "values": [
    { "name": "environmentName", "value": "production" },
    { "name": "maxBatchSize", "value": 500 },
    { "name": "enableDebugLogging", "value": false },
    { "name": "storageAccountName", "value": "mystorage" },
    { "name": "allowedRegions", "value": "[\"eastus\",\"westus2\"]" }
  ]
}

Creating the Variable Library via REST API

import os
import requests, json, base64, copy

FABRIC_TOKEN = "<fabric-token>"
FABRIC_WORKSPACE_ID = "<workspace-id>"
VARIABLE_LIBRARY_NAME = "GlobalParameters"
headers = {
    "Authorization": f"Bearer {FABRIC_TOKEN}",
    "Content-Type": "application/json"
}

# Per-request HTTP timeout (connect, read). Mirrors pipeline-orchestrator.md
# so long-running Variable Library creation / LRO polling never hangs
# indefinitely on a transient network stall.
_HTTP_TIMEOUT = (
    float(os.environ.get("FABRIC_HTTP_CONNECT_TIMEOUT", 10)),
    float(os.environ.get("FABRIC_HTTP_READ_TIMEOUT", 60)),
)


def b64(obj: dict) -> str:
    return base64.b64encode(json.dumps(obj).encode()).decode()


def convert_synapse_global_params(synapse_params: dict) -> dict:
    """
    Convert Synapse global parameters to Fabric Variable Library variables.json content.
    
    Returns:
        variables.json content dict
    """
    # Fabric Variable Library supports Boolean, Datetime, Guid, Integer,
    # Number, and String as data types, BUT "Number types aren't supported
    # in pipelines" (per the Variable library integration limitations doc:
    # learn.microsoft.com/fabric/data-factory/variable-library-integration-with-data-pipelines#known-limitations).
    # Because this skill consumes globals via @pipeline().libraryVariables.*,
    # any variable typed Number is silently unusable -- so Synapse Float and
    # Double must map to String here (with the numeric value serialized as
    # its string form by Fabric's runtime cast). Integer stays Integer.
    # Datetime and Guid surface as String inside pipelines per the same doc.
    TYPE_MAP = {
        "String": "String",
        "Int": "Integer",
        "Float": "String",   # Number unsupported in pipelines; preserve as String
        "Double": "String",  # Number unsupported in pipelines; preserve as String
        "Bool": "Boolean",
        "Array": "String",   # Serialize as JSON string
        "Object": "String",  # Serialize as JSON string
    }

    variables = []
    for name, param in synapse_params.items():
        synapse_type = param.get("type", "String")
        fabric_type = TYPE_MAP.get(synapse_type, "String")
        value = param.get("value")

        # Serialize array/object to JSON string
        if synapse_type in ("Array", "Object"):
            value = json.dumps(value)

        entry = {
            "name": name,
            "type": fabric_type,
            "defaultValue": value
        }
        if synapse_type in ("Array", "Object"):
            entry["description"] = f"Serialized JSON {synapse_type.lower()} — use json() to parse"

        variables.append(entry)

    return {
        "schema": "https://developer.microsoft.com/json-schemas/fabric/item/variablelibrary/definitionFiles/variables/1.0.0/schema.json#",
        "variables": variables
    }


def build_value_set(name: str, variables_def: dict) -> dict:
    """Build a value set from variables definition (copies default values)."""
    return {
        "schema": "https://developer.microsoft.com/json-schemas/fabric/item/variablelibrary/definitionFiles/valueSets/1.0.0/schema.json#",
        "name": name,
        "values": [
            {"name": v["name"], "value": v.get("defaultValue")}
            for v in variables_def["variables"]
        ]
    }


def create_variable_library(
    synapse_params: dict,
    workspace_id: str,
    library_name: str,
    additional_value_sets: list[str] = None
) -> str:
    """
    Create a Fabric Variable Library from Synapse global parameters.
    
    Args:
        synapse_params: Dict from Synapse ARM API `properties.globalParameters`
        workspace_id: Fabric workspace GUID
        library_name: Display name for the Variable Library item
        additional_value_sets: Optional list of extra value set names (e.g. ["dev","test","prod"])
    
    Returns:
        Created item ID (GUID)
    """
    variables_def = convert_synapse_global_params(synapse_params)
    value_set_names = ["default"] + (additional_value_sets or [])

    settings_content = {
        "schema": "https://developer.microsoft.com/json-schemas/fabric/item/variablelibrary/definitionFiles/settings/1.0.0/schema.json#",
        "valueSetsOrder": value_set_names
    }

    definition_parts = [
        {
            "path": "variables.json",
            "payload": b64(variables_def),
            "payloadType": "InlineBase64"
        },
        {
            "path": "settings.json",
            "payload": b64(settings_content),
            "payloadType": "InlineBase64"
        }
    ]

    for vs_name in value_set_names:
        value_set = build_value_set(vs_name, variables_def)
        definition_parts.append({
            "path": f"valueSets/{vs_name}.json",
            "payload": b64(value_set),
            "payloadType": "InlineBase64"
        })

    payload = {
        "displayName": library_name,
        "type": "VariableLibrary",
        "definition": {
            "format": "VariableLibrary",
            "parts": definition_parts
        }
    }

    r = requests.post(
        f"https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}/items",
        headers=headers,
        json=payload,
        timeout=_HTTP_TIMEOUT,
    )

    if r.status_code in (200, 201):
        # Fabric item creation typically returns 201 Created for synchronous success;
        # 200 OK is also accepted for endpoint variations. Some endpoints return an
        # empty or non-JSON body and provide the created item identity via the
        # Location header instead — handle that defensively rather than blindly
        # calling r.json()["id"], which would raise on empty/non-JSON bodies.
        item_id = None
        if r.content:
            try:
                item_id = r.json().get("id")
            except ValueError:
                item_id = None
        if not item_id:
            location = r.headers.get("Location") or r.headers.get("Content-Location")
            if location:
                if location.startswith("/"):
                    location = f"https://api.fabric.microsoft.com{location}"
                fetched = requests.get(location, headers=headers, timeout=_HTTP_TIMEOUT)
                fetched.raise_for_status()
                item_id = fetched.json().get("id")
        if not item_id:
            raise RuntimeError(
                f"Variable Library creation returned {r.status_code} but no item "
                f"id was found in the body or a Location header. "
                f"Headers: {dict(r.headers)}"
            )
    elif r.status_code == 202:
        # Fabric may return 202 + LRO headers for item creation
        op_url = r.headers.get("Location") or r.headers.get("Operation-Location")
        operation_id = r.headers.get("x-ms-operation-id")
        if not op_url and operation_id:
            op_url = f"https://api.fabric.microsoft.com/v1/operations/{operation_id}"
        if not op_url:
            raise RuntimeError("202 response with no LRO URL header")
        # Resolve relative LRO URLs (e.g. "/v1/operations/...") against the
        # Fabric base so requests.get() receives a valid absolute URL,
        # matching the normalization used in pipeline-orchestrator.md.
        if op_url.startswith("/"):
            op_url = f"https://api.fabric.microsoft.com{op_url}"
        import time
        # Configurable polling cadence — slow tenants/capacities can exceed
        # a fixed 30 * 2 s = 60 s budget. Env-var names match the orchestrator
        # so a single set of overrides applies to every LRO in this skill.
        max_polls = int(os.environ.get("FABRIC_LRO_MAX_POLLS", 150))
        base_poll_interval = float(os.environ.get("FABRIC_LRO_POLL_INTERVAL", 2))
        for _ in range(max_polls):
            # Honor Retry-After when the service supplies a polling cadence;
            # fall back to base_poll_interval otherwise.
            retry_after = r.headers.get("Retry-After")
            sleep_s = float(retry_after) if retry_after else base_poll_interval
            time.sleep(sleep_s)
            poll = requests.get(op_url, headers=headers, timeout=_HTTP_TIMEOUT)
            poll.raise_for_status()
            state = poll.json()
            # Refresh r for the next iteration's Retry-After read
            r = poll
            if state.get("status") == "Succeeded":
                # Different Fabric LRO endpoints return the new item ID in different
                # places — prefer createdItemId, fall back to result.id, then to
                # fetching resourceLocation. This avoids KeyError on endpoint variants.
                item_id = (
                    state.get("createdItemId")
                    or state.get("result", {}).get("id")
                )
                if not item_id:
                    resource_loc = state.get("resourceLocation") or poll.headers.get("Location")
                    if resource_loc:
                        if resource_loc.startswith("/"):
                            resource_loc = f"https://api.fabric.microsoft.com{resource_loc}"
                        created = requests.get(resource_loc, headers=headers, timeout=_HTTP_TIMEOUT)
                        created.raise_for_status()
                        item_id = created.json().get("id")
                if not item_id:
                    raise RuntimeError(
                        f"Variable Library LRO succeeded but no item ID was returned. "
                        f"Operation payload: {state}"
                    )
                break
            if state.get("status") in ("Failed", "Cancelled"):
                raise RuntimeError(f"Variable Library creation failed: {state}")
        else:
            raise TimeoutError(
                f"Variable Library creation LRO timed out after {max_polls} polls "
                f"(base interval {base_poll_interval}s). Increase "
                f"FABRIC_LRO_MAX_POLLS or FABRIC_LRO_POLL_INTERVAL for "
                f"slow tenants/capacities."
            )
    else:
        r.raise_for_status()

    print(f"✅ Variable Library '{library_name}' created: {item_id}")
    return item_id

Connecting the Variable Library to a Pipeline

After creating the Variable Library, add the libraryVariables block to each pipeline definition:

{
  "properties": {
    "activities": [...],
    "parameters": {...},
    "variables": {...},
    "libraryVariables": {
      "libraryId": "<variable-library-item-id>",
      "workspaceId": "<fabric-workspace-id>"
    }
  }
}

Add this to all pipelines that previously used @pipeline().globalParameters.*:

def attach_variable_library(
    pipeline_def: dict,
    library_id: str,
    workspace_id: str
) -> dict:
    """Add libraryVariables reference to a pipeline definition."""
    import copy
    pipeline_def = copy.deepcopy(pipeline_def)
    pipeline_def.setdefault("properties", {})["libraryVariables"] = {
        "libraryId": library_id,
        "workspaceId": workspace_id
    }
    return pipeline_def

Expression Rewrite

After creating the Variable Library and attaching it to pipelines, replace all expression references:

Before (Synapse)After (Fabric)
@pipeline().globalParameters.environmentName@pipeline().libraryVariables.environmentName
@pipeline().globalParameters.maxBatchSize@pipeline().libraryVariables.maxBatchSize

This replacement is included in the bulk transformation in notebook-activity-migration.md and pipeline-orchestrator.md. Use an object-walk that rewrites only ADF expression strings (string values starting with @) — a blind replace() on the serialized JSON would also mutate unrelated literal text such as descriptions, annotations, or embedded code snippets that happen to contain @pipeline().globalParameters. in prose form.

Keep in sync with the equivalent helpers in notebook-activity-migration.md (_rewrite_expressions inside transform_pipeline_notebook_activities) and pipeline-orchestrator.md (_rewrite_expressions inside the per-pipeline migration loop). Editing the rewrite rules in one place without updating the others will cause the three docs to drift.

def rewrite_global_parameters(node):
    if isinstance(node, dict):
        # Only rewrite within the canonical ADF/Fabric expression dict shape
        # ({"value": "@...", "type": "Expression"}) — never bare strings, so
        # description/annotation text or embedded code samples that contain
        # "pipeline().globalParameters." in prose aren't mutated.
        if (
            node.get("type") == "Expression"
            and isinstance(node.get("value"), str)
            and node["value"].startswith("@")
        ):
            return {
                **node,
                # Match the bare `pipeline().globalParameters.` substring so
                # both `@pipeline().globalParameters.x` AND nested forms
                # like `@concat('env=', pipeline().globalParameters.env)`
                # get rewritten. The outer startswith("@") guard above
                # still scopes this strictly to expression-shaped dicts.
                "value": node["value"].replace(
                    "pipeline().globalParameters.",
                    "pipeline().libraryVariables.",
                ),
            }
        return {k: rewrite_global_parameters(v) for k, v in node.items()}
    if isinstance(node, list):
        return [rewrite_global_parameters(v) for v in node]
    return node

pipeline_def = rewrite_global_parameters(pipeline_def)

Value Sets for Environment Promotion

Use value sets to maintain dev/test/prod environment-specific overrides without duplicating Variable Library items:

Create a prod value set with different values
prod_value_set = {
    "schema": "https://developer.microsoft.com/json-schemas/fabric/item/variablelibrary/definitionFiles/valueSets/1.0.0/schema.json#",
    "name": "prod",
    "values": [
        {"name": "environmentName", "value": "production"},
        {"name": "maxBatchSize", "value": 5000},       # Higher batch size in prod
        {"name": "enableDebugLogging", "value": False},
        {"name": "storageAccountName", "value": "prodstorageaccount"},
        {"name": "allowedRegions", "value": "[\"eastus\",\"westeurope\"]"}
    ]
}

When a pipeline runs, it uses the active value set selected at workspace or pipeline scope.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Microsoft
Publisher
Microsoft (Official)
Source
microsoft/skills-for-fabric · skills/pipeline-migration · commit f8fac11
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Also distributed in
microsoft/skills-for-fabric

AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download pipeline-migration.zip