fabric-cli

cheatsheet

Work seamlessly with Microsoft Fabric from the command line.

For a list of flags available in the CLI, see the Flags page.

Core commands

Resource commands

Additional commands

fab fs

Workspace, item and file system operations.

$ fab [command] <args> [flags]
Command Description Example
assign Assign a resource to a workspace assign <path> [-W] [-f]
cd Change to the specified directory cd <path>
cp (copy) Copy an item or file cp <from_path> <to_path> [-f]
export Export an item export <path> [-o <output_path>*] [-a] [-f]
exists Check if a workspace, item, or file exists exists <path>
get Get a workspace or item property get <path> [-q <jmespath_query>] [-o <output_path>] [-v]
import Import an item (create/modify) import <path> [-i <input_path>*] [--format <format>] [-f]
ln (mklink) Create a shortcut ln <path> [--type <type>] [--target <target>] [-i <input>] [-f]
ls (dir) List workspaces, items, and files ls <path> [-l] [-a]
mkdir (create) Create a new workspace, item, or directory mkdir <ws_name>.workspace [-P <params>]
mv (move) Move an item or file mv <from_path> <to_path> [-f]
open Open a workspace or item in browser open <path>
pwd Print the current working directory pwd
rm (del) Delete a workspace, item, or file rm <path> [-f]
set Set a workspace or item property set <path> [-q <jmespath_query>*] [-i <input_to_replace>*] [-f]
start Start a resource start <path> [-f]
stop Stop a resource stop <path> [-f]
unassign Unassign a resource from a workspace unassign <path> [-W] [-f]

Flags:

See usage examples:

fab acl

Manage permissions.

$ fab acl [subcommand] <path> [flags]
Subcommand Description Example
ls (dir) List ACLs for a workspace, item, or OneLake. acl ls <path> [-l]
rm (del) Remove an ACL from a workspace acl rm <path> [-I <identity>] [-f]
set Set access controls on a workspace acl set <path> [-I <identity>] [-R <role>] [-f]
get Get ACL details for a workspace, item or OneLake acl get <path> [-q <query>] [-o <output_path>]

Flags:

Examples:

# list workspace permissions
$ acl ls ws1.workspace -l

# query lakehouse permission details
$ acl get ws1.workspace/lh1.lakehouse -q [*].principal

# remove security group from a workspace
$ acl rm ws1.workspace -I fabgroup1 -f

# set permissions to a workspace (using objectId)
$ acl set ws1.workspace -I 45376d08-6d94-4875-89e9-ec4020ee4830 -R contributor -f

See more Usage examples.

fab label

Manage sensitivity labels.

$ fab label [subcommand] <path> [flags]
Subcommand Description Example
list-local List labels from local_definition_labels setting label list-local
set Set a sensitivity label label set <path> [-n <label_name>] [-f]
rm (del) Remove a sensitivity label label rm <path> [-f]

Flags:

Examples:

# set label
$ label set /ws1.workspace/nb1.notebook -n Non-Business -f

# remove label
$ label rm /ws1.workspace/nb1.notebook

Note: To use labels seamlessly, the CLI requires a local JSON file mapping label IDs to names. Set its path with: config set local_definition_labels <json_path>.

See more Usage examples.

fab job

Manage tasks and jobs.

$ fab job [subcommand] <path> [flags]
Subcommand Description Example
start Start an item (async) job start <path> [-P <params>] [-C <config>] [-i <json_path>]
run Run an item (sync) job run <path> [-P <params>] [-C <config>] [-i <json_path>] [--timeout <seconds>]
run-cancel Cancel an item run job run-cancel <path> [--id <id>] [-w]
run-list Retrieve the status of an item or sheduled job run job run-list <path> [--schedule]
run-update Update a scheduled job job run-update <path> [--id <id>] [-i <json_path>] [--type <type>] [--interval <interval>] [--start <utc_timestamp>] [--end <utc_timestamp>] [--days <days>] [--enable] [--disable]
run-sch Schedule a job for an item job run-sch <path> [-i <json_path>*] [--type <type>] [--interval <interval>] [--start <utc_timestamp>] [--end <utc_timestamp>] [--days <days>] [--enable]
run-status Get details of an item or sheduled job run job run-status <path> [--id <id>] [--schedule]

Flags:

Examples:

# Run a pipeline async",
$ job start pip1.datapipeline

# run a notebook sync with parameters
$ job run nb1.notebook -P string_param:string=new_value,int_param:int=10,float_param:float=0.1234,bool_param:bool=true

# Get the list of instance runs of a notebook
$ job run-list nb1.notebook 

# Check the status of an instance job
$ job run-status nb1.notebook --id 45376d08-6d94-4875-89e9-ec4020ee4830

# Cancel an instance job
$ job run-cancel nb1.notebook --id 45376d08-6d94-4875-89e9-ec4020ee4830

# Schedule and enable a notebook job
$ job run-sch nb1.notebook --type weekly --interval 19:43,22:00 --days Monday,Tuesday --start 2024-12-15T09:00:00 --end 2025-12-15T09:00:00 --enable

See more Usage examples.

fab table

Manage tables.

$ fab table [subcommand] <path> [flags]
Subcommand Description Example
load Load data into a table in the lakehouse table load <path> [--file <file>] [--extension <ext>] [--mode <mode>] [--format <format>]
optimize Optimize a Delta table table optimize <path> [--vorder] [--zorder <columns>]
schema Display the schema of a Delta table table schema <path>
vacuum Vacuum a Delta table by removing old files table vacuum <path> [--retain_n_hours <hours>]

Flags:

Examples:

# check Delta table schema
$ table schema lh1.Lakehouse/Tables/dbo/tdelta

# load csv to table
$ table load Tables/tdeltacsv --file Files/csv/employees.csv --mode append

# load parquet to table
$ table load Tables/tdeltaparquet --file Files/parquet --format format=parquet --mode append

# run table optimize with vorder and zorder
$ table optimize Tables/tdelta --vorder --zorder col1,col2

# vacuum a table (defaul 7 days)
$ table vacuum Tables/tdelta

See more Usage examples.

fab api

Make an authenticated API request.

$ fab api <endpoint> [flags]

Flags:

Examples:

$ api -X get workspaces --show_headers

See more Usage examples.

fab auth

Authenticate fab with Microsoft Fabric.

$ fab auth [subcommand] [flags]
Subcommand Description Example
login Log in to a Fabric account auth login
logout Log out of a Fabric account auth logout
status Display active account and authentication state auth status

Flags:

The default authentication mode uses an interactive web-based browser flow. Once complete, the authentication token is stored in an encrypted file in the package’s installation directory. If OS encryption isn’t available, you can store the token in plain text by setting config set encryption_fallback_enabled true. This token enables future requests, so ensure the file has proper permissions to prevent unauthorized access.

Alternatively, fab can use the authentication token found in environment variables. This method is most suitable for “headless” use of fab such as in automation. Set FAB_TOKEN, FAB_TOKEN_ONELAKE, FAB_TOKEN_AZURE and FAB_TENANT_ID. See all Environment variables.

Examples:

# command_line mode
$ fab auth login

# command_line mode using service principal auth with client secret
$ fab auth login -u <client_id> -p <client_secret> --tenant <tenant_id>

# command_line mode using service principal auth with certificate
$ fab auth login [-u <client_id>] [--certificate </path/to/certificate.[pem|p12|pfx]>] [--tenant <tenant_id>]

# command_line mode using service principal auth with federated token
$ fab auth login [-u <client_id>] [--federated-token <token>] [--tenant <tenant_id>]

# command_line mode using managed identity auth
$ fab auth login --identity

Note: For Service Principal auth, ensure the following tenant settings are enabled: “Allow service principals to use Power BI APIs” and “Users can access data stored in OneLake with external apps”. The service principal must also have access to at least one workspace with an assigned role.

See more Usage examples.

fab config

Manage configuration settings.

$ fab config [subcommand] <args>
Subcommand Description Example
clear-cache Clear the CLI cache config clear-cache
get Print the value of a given configuration key config get <key>
ls (dir) Print a list of configuration keys and values config ls
set Update configuration with a value for the given key config set <key> <value>

Examples:

# get current CLI mode
$ config get mode

# switch to command_line mode
$ config set mode command_line

# clear cache
$ config clear-cache

See more Usage examples. See also respected Environment variables and settings.

fab desc

Show commands supported by each Fabric element or path.

$ fab desc <args>

Examples:

$ desc .capacity
$ desc .capacities/capac1.Capacity
$ desc .workspace
$ desc /ws1.Workspace/nb1.Notebook

See more Usage examples.