nb-fabric-0.2.0 is not a library.
Open beta. Commands and flags may change between versions. Pin your version if stability matters.
Install
Or download a prebuilt binary from Releases.
Prerequisites
- Azure CLI (
az) installed and authenticated (az login) - Access to a Microsoft Fabric workspace
Quick Start
# Check auth
# List notebooks
# Create a Python notebook with a lakehouse attached
# Add a cell
# Execute interactively and see the output
# Run as a batch job
Command Reference
Authentication
nb auth status Check Azure CLI authentication
Notebook CRUD
nb list <workspace> List notebooks in a workspace
nb create <ws/name> Create a new notebook
--kernel python|pyspark Kernel type (default: python)
--lakehouse <name> Attach a lakehouse
--warehouse <name> Attach a warehouse
nb export <ws/name> -o <path> Export notebook to local .ipynb
nb open <ws/name> Open notebook in browser
nb delete <ws/name> --force Delete a notebook
Cell Operations
nb cells <ws/name> List all cells (index, type, preview)
nb cell view <ws/name> <index> View a single cell's source
nb cell add <ws/name> Add a new cell
--code <code> Cell content (required)
--markdown Create markdown cell (default: code)
--at <index> Insert at position (default: append)
nb cell edit <ws/name> <index> Replace a cell's source
--code <code> New content
nb cell rm <ws/name> <index> Remove a cell
Execution
nb exec <ws/name> Execute code interactively via Livy
--code <code> Code to execute
<cell-index> Or execute a specific cell by index
--lakehouse <name> Lakehouse for Livy session (auto-detected)
nb run <ws/name> Run notebook as batch job
--wait Wait for completion
--timeout <secs> Timeout in seconds (default: 3600)
nb runs <ws/name> List recent runs
Interactive execution auto-detects the kernel type from notebook metadata:
- Python notebooks use Livy
kind=python - PySpark notebooks use Livy
kind=pyspark
Both return cell output directly to the terminal.
Sessions
nb session <ws/name> Show active Livy sessions
Scheduling
nb schedule list <ws/name> List schedules
nb schedule create <ws/name> Create a schedule
--type Cron|Daily|Weekly Schedule type (default: Cron)
--interval <n> Interval (minutes for Cron)
--start <datetime> Start time (ISO 8601)
--end <datetime> End time (optional)
--timezone <tz> Timezone (default: UTC)
--enable Enable immediately
nb schedule update <ws/name> <id> Update a schedule
--enable true|false Enable or disable
--interval <n> New interval
nb schedule delete <ws/name> <id> Delete a schedule
How It Works
nb authenticates via Azure CLI (az account get-access-token) using the same credentials as fab and az. It calls the Fabric REST API for notebook management and the Livy API for interactive execution.
Authentication
No service principal required. nb uses your Azure CLI session:
Notebook Formats
nb create generates notebooks with the correct Fabric metadata for either kernel:
| Field | Python | PySpark |
|---|---|---|
kernel_info.name |
jupyter |
synapse_pyspark |
microsoft.language_group |
jupyter_python |
synapse_pyspark |
Livy kind |
python |
pyspark |
Interactive Execution
nb exec creates a Livy session, submits code, returns output, and cleans up the session:
$ nb exec "My Workspace/Analytics" --code "print(2+2)" --lakehouse MainLH
Creating Livy session (kind=python)...
Session created; waiting for idle state...
Submitting code...
4
Session cleaned up
Building from Source
# Binary at target/release/nb
License
GPL-3.0