fabric-cli

api examples

Important: When using interactive authentication, some api commands may have limited functionality. If you encounter permission issues while using certain api commands, consider using service principal authentication as an alternative.

Supported commands: fab api -h

Interacting with Fabric API

Interact with Fabric REST API from CLI. See supported Flags.

# get Fabric workspaces
fab:/$ api workspaces

# get all lakehouses in a workspace
fab:/$ api -X get workspaces/762811e8-e364-4817-9557-f2ca363661cb/lakehouses --show_headers

# create an empty notebook in a workspace using inline JSON
fab:/$ api -X post workspaces/762811e8-e364-4817-9557-f2ca363661cb/lakehouses -i {"displayName": "nbapi"}

# create an empty notebook in a workspace using local JSON path
fab:/$ api -X post workspaces/762811e8-e364-4817-9557-f2ca363661cb/lakehouses -i /tmp/test.json

# Upload a whl file to a staging environment using local path
fab:/$ api -X post workspaces/762811e8-e364-4817-9557-f2ca363661cb/environments/b12cd397b-e500-788j-ae53-1b0008014120/staging/libraries -i /tmp/mylib.whl

Interacting with OneLake API

Interact with OneLake REST API from CLI using the storage audience.

# get content from Lakehouse/Files section
fab:/$ api -A storage ws1/lh1.Lakehouse/Files?resource=filesystem&recursive=false

# using parameters
fab:/$ api -A storage ws1/lh1.Lakehouse/Files -P resource=filesystem,recursive=false --show_headers

Interacting with ARM API for Fabric capacities

Interact with Azure Resource Manager (ARM) REST API for Fabric capacities from CLI with azure audience.

# list by subscription
fab:/$ api -A azure subscriptions/b12cd397b-e500-788j-ae53-1b0008014120/providers/Microsoft.Fabric/capacities?api-version=2023-11-01

# list skus
fab:/$ api -A azure subscriptions/b12cd397b-e500-788j-ae53-1b0008014120/providers/Microsoft.Fabric/skus?api-version=2023-11-01

Interacting with Power BI API

Interact with Power BI REST API from CLI with powerbi audience.

# list datasets in a group
fab:/$ api -A powerbi groups/addb15df-4af9-44f2-9b8b-c65c0b6086cd/datasets

# list groups
fab:/$ api -A powerbi groups

See all examples