Configuration from the builderRuntime, Spark properties, Spark pool and NEE become environment_*.jsonc and workspaces_*.json for the repo's deploy/ folder. No clicks in the UI.
Code from the repoYour enterprise functions aren't configuration: they're your code, built into a versioned wheel from src/ and installed by the Environment in every workspace.
Dev → approval → proValidate, bootstrap and deploy locally first, then let Azure DevOps promote every change with an approval before production.
1

Names and workspaces

Names follow the site's naming convention. The Environment gets the same name pattern in every workspace of a stage. Each workspace also needs the vl_environment Variable Library (see the requirements). If it doesn't exist, the bootstrap in step 8 creates it.

Environment:

Don't copy ids one by one: get them from Fabric with one of the two options below and paste the output here (a workspaces_*.json works too). For a single workspace, the id is in its URL: app.fabric.microsoft.com/groups/<workspace-id>/..., and you can paste the whole URL after the =.

Get every workspace name and id automatically

From a terminal, with the repo's list_workspaces.py. It logs in with your user in the browser, lists every workspace you can see and keeps the ones starting with dev_ / pro_. Add --write to save workspaces_*.json directly, or --spn to list only what the Service Principal can reach.

From any Fabric notebook, nothing to install: Semantic Link lists the workspaces you have access to.

2

Runtime

Pick a runtime per stage. Piloting 2.0 in dev while production stays on 1.3 is a normal setup. The runtime also decides which Spark properties you still have to set in the next step, because 2.0 turns several Delta optimizations on by default.

Dev runtime
Production runtime

The first deploy sets the runtime on the empty Environment. After that, changing it goes through migrate_runtime.py (see More options).

3

Spark properties

Applied when every session starts, so no notebook needs spark.conf.set() for them. The file is the complete list: anything added by hand in the UI is removed on the next deploy. The table shows what each stage will set and what its runtime already does for you.

Spark propertyDevProduction
4

Spark pool and compute

Pick the pool (the Starter Pool, or a custom pool that already exists in the workspace or capacity) and size dev and production separately: dev usually needs small nodes and few executors, so it doesn't burn capacity units, while production gets what the real volumes need. Each profile applies to the workspaces you tick; the rest get {}, which means "leave the compute as it is". Needs Customize compute configurations for items turned on in each workspace's Spark settings.

Dev

Apply to

Production

Apply to

5

Native Execution Engine

NEE runs Spark SQL and DataFrame operations in native, vectorized code instead of the JVM. It's off by default on 1.3 and on 2.0: Runtime 2.0 turns many Delta optimizations on, but not this one. It's one Spark property, added to every stage.

After the deploy, check_environment(spark) warns if NEE is off, and the Spark UI's Queries for Native Engine tab shows which operators ran natively. If one query regresses, turn NEE off for that block only:

with native_disabled(spark):
    save_table(df_problematic, paths["path_silver"], "customers_history")
6

Your enterprise functions

This is the one point the builder doesn't generate, on purpose: your shared functions are code, not configuration. They go in the repo's src/fabric_utils and are built into a wheel, so every change is versioned, reviewed in a pull request, built by the pipeline before it reaches Fabric, and promoted to production only after an approval. Every workspace runs the same version, and check_environment() tells you which one. Here you only name the package, so the file names and commands below match.

Wheel:

In pyproject.toml, under [project]:

Add a function: the same four steps every time

  1. Write it in src/fabric_utils/. business.py is the template for business rules, e.g. add_surrogate_key().
  2. Export it in src/fabric_utils/__init__.py, so from fabric_utils import * picks it up.
  3. Bump the version in pyproject.toml and __version__.
  4. Open a pull request. The pipeline (step 9) builds the new wheel and deploys it: dev automatically, production after approval.

Use it in any notebook of the workspace: no %run, no %pip install

from fabric_utils import *

paths = get_paths()                      # "dev" or "pro", from the Variable Library
df = load_data(paths["path_bronze"], "customers")
df = deduplicate(trim_string_columns(df), keys=["customer_id"], order_by="modified_at")
df = add_surrogate_key(df, keys=["customer_id"], name="sk_customer")
save_table(df, paths["path_silver"], "customers")

What goes in: anything more than one notebook uses (paths, read/write, schema, logging, business rules). What stays out: the logic for one specific table. More on why a wheel and not a Functions notebook.

7

Your config files

Save all four in the repo's deploy/ folder, replacing the examples. They're checked again by --validate-only before anything touches Fabric.

8

Deploy it

Run these from a terminal, in order. Bootstrap uses your user once. Everything after that uses the Service Principal, which needs the Contributor role on every workspace above.

Then import notebooks/nb_check_environment.ipynb into a dev workspace and run it. It prints the runtime, the library version and every key property, and warns if NEE is off.

9

Automate it in Azure DevOps

The repo's azure-pipelines.yml runs Build (validate + wheel) on every PR and push, then DeployDev automatically and DeployPro after an approval. One-time setup:

  1. Pipelines › Library: a variable group named fabric-deploy-secrets with FABRIC_TENANT_ID, FABRIC_CLIENT_ID and FABRIC_CLIENT_SECRET (mark it secret, or link the group to Azure Key Vault).
  2. Pipelines › Environments: create fabric-dev and fabric-pro. On fabric-pro, open Approvals and checks › Approvals and add whoever signs off production.
  3. Pipelines › New pipeline: pick the repo and choose Existing Azure Pipelines YAML file, then /azure-pipelines.yml.
  4. In Fabric's admin portal, allow the Service Principal to use Fabric APIs (Service principals can use Fabric APIs).
push to main (src/, deploy/, pyproject.toml)
   ├─ Build       validate both config files + build the wheel
   ├─ DeployDev   deploy.py --target dev          (automatic)
   ├─ [ approval on "fabric-pro" ]
   └─ DeployPro   deploy.py --target pro

For every release, bump version in pyproject.toml and __version__ in src/fabric_utils/__init__.py, so check_environment() tells you which version is live.

More options

Move an existing Environment to another runtime

On the first deploy, the Environment is still empty, so deploy.py sets the runtime from your file. Once a library is published, changing the runtime directly fails with LibraryManagementError, and deploy.py stops with a message instead. Change runtimeVersion in the file (the builder above updates the Spark properties to match), then run the migration: remove libraries, publish, change runtime, upload, publish. Do dev first, test your notebooks on the new Spark version, then production. It isn't in the pipeline on purpose.

Doing it by hand in the Fabric UI

Useful for checking what the scripts do, or for debugging. In each workspace: create the Utils folder and an Environment inside it → choose the runtime before uploading anything → Custom libraries › Upload the wheel → Spark compute › Compute (pool, cores, memory) → Spark compute › Spark properties (one row per property, or the Acceleration tab for NEE) → Publish and wait for Success (3–6 min) → Workspace settings › Data Engineering/Science › Spark settings › Environment › set it as default. Anything you change by hand must also go into the .jsonc file, or the next deploy overwrites it.

Troubleshooting
ErrorWhat to do
403 FeatureNotAvailable creating an itemThe Service Principal can't create items in your tenant. Run bootstrap_environments.py, which uses your user.
Environment is on runtime X, config says YRun migrate_runtime.py, or put the current runtime back in the file.
LibraryManagementErrorThe runtime was changed with a library published. Use migrate_runtime.py.
publish operation in progressSomeone else is publishing that Environment. deploy.py skips it; run again later.
A property I added in the UI disappearedsparkProperties is the complete list. Add it to the .jsonc file.
Compute update rejectedTurn on Customize compute configurations for items, and keep cores within the pool's node size (Starter Pool = 8 cores).

Sources