Work seamlessly with Microsoft Fabric from the command line.
For a list of flags available in the CLI, see the Flags page.
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:
-a, --all
: [Optional] Show or select all. Optional for cp
, export
, ls
and mv
.-f, --force
: [Optional] Force, no confirmation. Use with caution.-i, --input
: [Optional] Input, specify input file path or value. *Required for import
and set
.-l, --long
: [Optional] List details.-o, --ouput
: [Optional] Output, specify output file path. *Required for export
.-P, --params
: [Optional] Key=value parameters, comma-separated. -P
lists required and optional parameters.-q, --query
: [Optional] JMESPath query to filter. *Required for set
.-v, --verbose
: Verbose output, all JSON properties.-W, --workspace
: Workspace name for assign
and unassign
.--format
: [Optional] Input format. Only supported for Notebooks (.ipynb, .py). Default .ipynb.--type
: Shortcut type (adlsGen2, amazonS3, dataverse, googleCloudStorage, oneLake, s3Compatible).--target
: Required for external shortcuts.See usage examples:
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:
-f, --force
: [Optional] Force, no confirmation. Use with caution.-I, --identity
: Entra identity.-l, --long
: [Optional] Show detailed output.-o, --output
: [Optional] Output path for export.-q, --query
: [Optional] JMESPath query to filter.-R, --role
: ACL role (admin, member, contributor, viewer).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.
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:
-f, --force
: [Optional] Force, no confirmation. Use with caution.-n, --name
: Sensitivity label name.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.
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:
-C, --config
: [Optional] JSON payload for configuration of a Notebook, inline or path.-i, --input
: [Optional] JSON payload, inline or path. *Required for run-sch
.-P, --params
: [Optional] Parameters in name:type=value format, separated by commas.-w, --wait
: [Optional] Wait for the job to cancel.--days
: [Optional] Days of the week.--enable
, --disable
: Enable or disable a schedule. Optional--end
: [Optional] End date and time in UTC--id
: Job Schedule or Execution ID.--interval
: [Optional] Interval in minutes or time list.--schedule
: [Optional] Schedule runs.--start
: [Optional] Start date and time in UTC.--timeout
: [Optional] Timeout in seconds for synchronous run command.--type
: [Optional] Type of schedule (cron, daily, weekly) *Required for run-sch
if input missing.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.
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:
--extension
: [Optional] File extension to filter files.--file
: Path to the file or directory to load.--format
: [Optional] Format options in key=value format, separated by commas. Default: format=csv,header=true,delimiter=’,’.--mode
: [Optional] Mode to load the data (append, overwrite). Default: overwrite.--retain_n_hours
: [Optional] Retention period in hours. Default: 168 (7 days).--vorder
: [Optional] Enable V-Order.--zorder
: [Optional] List of columns to Z-Order by, separated by commas.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.
Make an authenticated API request.
$ fab api <endpoint> [flags]
Flags:
-A, --audience
: [Optional] Audience for token (fabric, storage, azure, powerbi). Default: fabric.-H, --headers
: [Optional] Additional request headers in key=value format, separated by commas.-i, --input
: [Optional] Request body (if applicable).-P, --params
: [Optional] Query parameters in key=value format, separated by commas.-q, --query
: [Optional] JMESPath query to filter the response.-X, --method
: [Optional] HTTP method (get, post, delete, put, patch). Default: get.--show_headers
: [Optional] Include headers in the response.Examples:
$ api -X get workspaces --show_headers
See more Usage examples.
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:
-I, --identity
: [Optional] Use managed identity, only for managed identity auth.-p, --password
: [Optional] Client password, only for service principal auth.-u, --username
: [Optional] Client ID, only for service principal or system assigned managed identity auth.-t, --tenant
: [Optional] Tenant ID.--certificate
: [Optional] Path to the pem certificate file, only for service principal auth.--federated-token
: [Optional] Federated Token for OpenID authentication, only for service principal auth.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.
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.
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.