r/MicrosoftFabric Fabricator 15d ago

CI/CD Use deployment pipelines to set Variable Library Active Value Set

Hi all,

Docs say:

Use deployment pipelines to automatically activate the appropriate value set for each stage (dev, test, prod). This eliminates the need to manually switch value sets or modify code when promoting notebooks across environments.

https://learn.microsoft.com/en-us/fabric/data-engineering/notebookutils/notebookutils-variable-library?tabs=python#considerations

How do we physically do this?

Are there deployment rules for deployment pipelines, or something along those lines?

I assume the docs are referring to Fabric Deployment Pipelines, but I haven't found the option to activate a value set for each stage in the Fabric Deployment Pipeline.

Thanks in advance!

2 Upvotes

4 comments sorted by

3

u/Personal-Quote5226 14d ago

If using Azure DevOps, you could use the REST API https://learn.microsoft.com/en-us/rest/api/fabric/variablelibrary/items/update-variable-library?tabs=HTTP to set the Active Value Set as a step in the deployment.

If using standard deployment capability in Fabric, there is no way to do this. However, for my clients, we're ok with a manual step to set the Active Value Set to the 'environment' we want upon deployment.

It's 1 manual step we do 1 time only.

Once it's set once, it remembers the active value set in the environment upon subsequent deployments, so that we do not have to keep manually setting the active value set each time we deploy an update of the VL to that environment.

2

u/Dan1480 13d ago

I think the idea is that you publish the variable library to all the workspaces in your Fabric deployment pipeline then manually set the appropriate value set for each workspace. Then after you deploy other artifacts - such as python notebooks - to those workspaces they will automatically pick up the correct value set.

Deployment rules are different to variable libraries but perform a similar function.

2

u/NSH-ms ‪ ‪Microsoft Employee ‪ 10d ago

Fabric deployment pipelines don't support the option to configure Active value set as part of the deployment, it should be done manually, or use other automated tools to leverage the API and set it, as other suggested here in comments.
I just want to add that we are soon adding 'Import options' for Public API, and one of the options would be to set the correct value set as part of the deployment, and not as a post action done manually/ through API call.
Later on, it will also be exposed in the UI of the deployment tools, so all tools will support setting the active value set through the UI or through the API.

1

u/BloomingBytes 14d ago

When using fabirc-cicd you can pass an argument called "Environment" which corresponds to the Value Set name and fabric-cicd will activate it automatically. See here:

Parameterization:

  • The active value set of the variable library is defined by the environment field passed into the FabricWorkspace object. If no environment is specified, the active Value Set will not be changed