TLDR : Outlines using Microsoft Fabric Variable Libraries to manage environment-specific configurations in CI/CD without mutating JSON. Walks through prerequisites (Dev/Test/Prod workspaces), CI/CD flow with Azure DevOps pipelines, design of variable libraries and automated variable resolution, limitations, and an alternative approach via ADO + fabric-cicd
Preface #
A common challenge with Fabric CI/CD is managing environment-specific configurations stored in JSON files that must be modified at each deployment stage. While functional, this creates operational overhead, raises the risk of configuration drift and deployment errors, and becomes harder to maintain as environments and teams grow
To simplify this, I explored native options in Microsoft Fabric and landed on Variable Libraries as a cleaner way to manage environment-specific configuration without mutating JSON during deployments.
This blog documents that journey, focusing on:
- Using Fabric Variable Libraries for environment configuration
- Implementing Azure DevOps CI/CD pipelines with Fabric Deployment Pipelines
- Calling out current limitations of Variable Libraries
- Comparing this approach with a pure ADO + fabric-cicd alternative
All examples and screenshots are from a lab setup, with a strong CI/CD focus inspired by Tim’s Variable Library deep dive.
Prerequisites #
Before proceeding, ensure you have the following prerequisites in place:
- Three Fabric workspaces: Dev, Test, and Prod
- Git integration enabled on the Dev workspace
- A Fabric Deployment Pipeline linking Dev → Test → Prod
- A Variable Library created with value sets for each environment
- An Azure DevOps service connection (Service Principal) with access to Fabric
- Appropriate Tenant Settings are Enabled
- Lakehouse/Warehouse and Connections are already created
What is a Variable Library #
A Variable Library 1 in Microsoft Fabric item used to centrally manage configuration values that vary across environments (for example: workspace IDs, lakehouse IDs, storage endpoints, or connection names).
A single Variable Library can contain:
- Multiple variables
- Each variable can have different types (string, integer, boolean, guid ,dateTime)
- Multiple value sets, typically aligned to environments such as
Dev,Test, andProd
At runtime or deployment time, Fabric resolves variables based on the default or active value set, removing the need to rewrite configuration files or hard-code environment details in pipelines.
How we will use it in this blog #
In this CI/CD walkthrough, the Variable Library will be used to:
- Store environment-specific connection identifiers (e.g., source/destination lakehouse IDs, workspace IDs)
- Decouple pipeline logic from environment configuration
- Eliminate JSON mutation during deployments
- Allow the same Fabric artifacts to move across environments unchanged
The Variable Library will be deployed alongside Fabric items and referenced by pipelines, copy activities, and notebooks, while environment switching is handled through value sets.
This setup ensures artifacts can be source-controlled, promoted across environments, and configured through Variable Libraries without modifying deployment logic.
CI/CD Flow Overview #
The CI/CD flow starts with Git integration2 enabled on the Dev Fabric workspace. All Fabric artifacts, including the Variable Library, are source-controlled and serve as the single source of truth. ( Note: I am not using feature branches in this example for simplicity).
An Azure DevOps pipeline is triggered when changes are merged to the main branch. Fabric Deployment Pipelines are then used to promote artifacts from Dev to Test and Prod. After each successful deployment, a PowerShell script calls the Fabric REST API (PATCH method) to activate the appropriate Variable Library value set for the target stage (e.g., “Test” value set for Test stage, “Production” for Prod stage).
This removes the need for JSON mutation or stage-specific scripts. The same artifacts move across environments unchanged, while environment-specific values (connections, paths, identifiers) are automatically resolved based on the active Variable Library value set for each stage.
Variable Library Design #
The Variable Library is designed to hold only environment-specific values, keeping all Fabric artifacts environment-agnostic.
Dev, Test, Prod), with consistent variable names across all value sets.(Note: My script assumes that Deployment Pipeline stages are named exactly as the Variable Library value sets for simplicity).
This design allows the same pipelines, notebooks, and copy activities to be deployed unchanged, while Fabric resolves the correct values at runtime based on the target environment.
Azure DevOps Pipeline (Automated) #
The Azure DevOps pipeline is responsible for orchestrating the deployment across environments (Development → Test → Production), not for managing environment-specific configuration values. The pipeline triggers on changes to the main branch and executes PowerShell tasks to authenticate and invoke Fabric deployment actions.
Environment-specific configuration values (connection strings, paths, parameters) are delegated entirely to Fabric through the Variable Library. The pipeline automatically activates the appropriate value set based on the target stage, keeping configuration management centralized in Fabric rather than scattered across pipeline variables. This separation makes the pipeline simple, repeatable, and configuration-agnostic.
The below pipeline showcases a two-stage deployment: Dev → Test and Test → Prod. For each stage, a PowerShell script calls the Fabric Deployment Pipelines API to promote artifacts, then issues a PATCH request to activate the appropriate Variable Library value set for that environment, ensuring environment-specific configurations without file mutations.
trigger:
branches:
include:
- main
Snip..Snip
stages:
# ============================================================================
# Stage 1: Deploy from Dev to Test (Selective by Type)
# ============================================================================
- stage: DeployToTest
displayName: 'Deploy Dev to Test (By Type)'
jobs:
- deployment: DeployDevToTest
displayName: 'Deploy to Test Environment'
environment: 'Fabric-Test' # Approvals in Azure DevOps Environments
pool:
vmImage: 'windows-latest'
strategy:
runOnce:
deploy:
steps:
- checkout: self
displayName: 'Checkout Repository'
- task: PowerShell@2
displayName: 'Deploy Selected Item Types: Dev -> Test'
inputs:
filePath: '$(Pipeline.Workspace)/s/DeploymentScripts/Deploy-SelectiveByType.ps1'
arguments: >
-deploymentPipelineName "$(DeploymentPipelineName)"
-sourceStageName "Development"
-targetStageName "Test"
-clientId "$(ClientId)"
-tenantId "$(TenantId)"
-servicePrincipalSecret "$(ServicePrincipalSecret)"
-deploymentNote "Selective deployment from Azure DevOps - Build $(Build.BuildNumber)"
-variableLibraryName "$(VariableLibraryName)"
-itemTypes $(ItemTypes)
pwsh: true
env:
VariableLibraryName: $(VariableLibraryName)
Snip..Snip
# ============================================================================
# Stage 2: Deploy from Test to Prod (Selective by Type)
# ============================================================================
- stage: DeployToProduction
displayName: 'Deploy Test to Production (By Type)'
dependsOn: DeployToTest
condition: succeeded()
jobs:
- deployment: DeployTestToProduction
displayName: 'Deploy to Production Environment'
environment: 'Fabric-Production' # Approvals in Azure DevOps Environments
Snip..Snip
Deployment Pipelines and Variable Resolution #
Fabric Deployment Pipelines4 promote artifacts from Dev to Test and Prod. During deployment, Fabric automatically resolves variables using the value set associated with the target stage.
After successfully deploying artifacts through the Fabric Deployment Pipelines API, the critical step is activating the correct Variable Library value set for the target environment. This is accomplished through a PATCH operation to the Fabric REST API.
The Variable Library Update Function #
function UpdateVariableLibraryActiveValueSet($variableLibraryName, $targetValueSet, $targetWorkspaceId) {
Write-Host "`nUpdating active value set to '$targetValueSet' in Variable Library '$variableLibraryName'..." -ForegroundColor Cyan
try {
# 1: Get the Variable Library item to find its GUID
$itemsUrl = "{0}/workspaces/{1}/items?type=VariableLibrary" -f $global:baseUrl, $targetWorkspaceId
$items = (Invoke-RestMethod -Uri $itemsUrl -Headers $global:fabricHeaders -Method Get).value
$variableLibrary = $items | Where-Object { $_.displayName -eq $variableLibraryName }
if (-not $variableLibrary) {
Write-Host "Variable Library '$variableLibraryName' not found in target workspace." -ForegroundColor Yellow
return
}
$itemId = $variableLibrary.id
Write-Host "Found Variable Library with ID: $itemId" -ForegroundColor Gray
# 2: Use the PATCH API to set active value set
$patchUrl = "{0}/workspaces/{1}/VariableLibraries/{2}" -f $global:baseUrl, $targetWorkspaceId, $itemId
$body = @{
properties = @{
activeValueSetName = $targetValueSet
}
} | ConvertTo-Json -Depth 10
# 3: Execute the PATCH request
$response = Invoke-RestMethod -Uri $patchUrl -Method Patch -Headers $global:fabricHeaders -Body $body
Write-Host "Successfully changed active value set to '$targetValueSet'" -ForegroundColor Green
}
catch {
Write-Host "Failed to set active value set: $($_.Exception.Message)" -ForegroundColor Red
Write-Host "Please manually select '$targetValueSet' as the active value set in the Fabric UI." -ForegroundColor Yellow
}
}
How It Works #
The function executes in three steps:
- Locate the Variable Library: Queries the target workspace for all Variable Library items and finds the matching one by name, retrieving its unique GUID.
- Construct the PATCH request: Builds the API URL and payload with the target value set name (e.g., “Test” for Test stage, “Production” for Prod stage).
- Execute and Verify: Sends the PATCH request to activate the specified value set, ensuring all subsequent artifact executions use the correct environment configuration.
This function is invoked immediately after a successful deployment completes:
# After deployment succeeds...
if(-not [string]::IsNullOrEmpty($variableLibraryName)) {
$targetWorkspaceId = $targetStage.workspaceId
UpdateVariableLibraryActiveValueSet $variableLibraryName $targetStageName $targetWorkspaceId
}
The script assumes the Deployment Pipeline stage names (e.g., “Test”, “Production”) exactly match the Variable Library value set names for automatic alignment.
Key API Endpoint #
PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/VariableLibraries/{itemId}
Request Body:
{
"properties": {
"activeValueSetName": "Test"
}
}
This single PATCH 5 request eliminates manual configuration switching and ensures immediate environment alignment after deployment.
This is the key benefit: the same artifact definition is deployed across all environments, while connections and identifiers are substituted at deployment or runtime based on the Variable Library. No JSON files are modified, and no custom replacement logic is required in the pipeline.
Limitations of Variable Libraries (Today) #
today.
Key limitations include:
- Size and structure limits (scalar values only)
- Max 1,000 variables and 1,000 value sets per library.
- Combined alternative value-set cells < 10,000.
- Item size ≤ 1 MB.
- Note field ≤ 2,048 characters.
- Value-set description ≤ 2,048 characters.
- Active value set is applied at the library level, not per variable
Alternative value set constraints
- Order is fixed by creation; UI reordering not supported (
JSON edit required). - Value-set names must be unique within the library.
- Variable names must be unique within the library (duplicates allowed across different items).
- Exactly one active value set at a time.
- Active value sets cannot be deleted; another must be activated first.
- Different deployment pipeline stages can have different active value sets.
These constraints influence how far Variable Libraries can be pushed in complex CI/CD scenarios. Along with that there are limitations to where and how variables can be referenced in Fabric artifacts , most of of its documented on this excellent blog by Tim :
Alternative: ADO + fabric-cicd (Without Deployment Pipelines) #
In scenarios where Fabric Deployment Pipelines are too restrictive, a pure Azure DevOps approach using the fabric-cicd framework/SDK 6 can be used.
Variable Libraries can still be used, but environment alignment is handled through naming conventions and pipeline configuration rather than Deployment Pipeline stages.
This approach o ffers more control and automation at the cost of additional pipeline complexity.
When to Use Which Approach #
Use Deployment Pipelines + Variable Libraries when:
- You want native Fabric lifecycle management
- Environment promotion is linear (Dev → Test → Prod)
- Minimal pipeline logic is preferred
Use ADO + fabric-cicd when:
- Full YAML-driven control is required
- Deployment Pipelines are too limiting
- Advanced automation or custom promotion logic is needed
Closing Notes #
Variable Libraries significantly reduce configuration drift and deployment overhead in Fabric CI/CD. They eliminate the need for JSON mutation and keep artifacts portable across environments.
However, they are not a silver bullet. Understanding their limitations and choosing the right CI/CD model is essential for a maintainable and scalable Fabric deployment strategy. Keep an eye on future Fabric updates7, as Variable Libraries and Deployment Pipelines are actively evolving along with Deployment Rules( promising but manual and limited for now)8
-
https://learn.microsoft.com/en-us/fabric/cicd/variable-library/variable-library-overview ↩︎
-
https://learn.microsoft.com/en-us/fabric/cicd/manage-deployment ↩︎
-
https://learn.microsoft.com/en-us/fabric/cicd/deployment-pipelines/intro-to-deployment-pipelines?tabs=new-ui ↩︎
-
Baseline : https://github.com/microsoft/fabric-samples/blob/main/features-samples/fabric-apis/DeploymentPipelines-DeployAll.ps1 ↩︎
-
https://learn.microsoft.com/en-us/rest/api/fabric/variablelibrary/items/update-variable-library?tabs=HTTP ↩︎
-
https://roadmap.fabric.microsoft.com/?product=administration%2Cgovernanceandsecurity ↩︎
-
https://learn.microsoft.com/en-us/fabric/cicd/deployment-pipelines/create-rules?tabs=new-ui ↩︎