Skip to main content

Microsoft Fabric CLI

PyPi version Python versions Code style: black License: MIT

The Microsoft Fabric CLI (fab) is a powerful, file-system-inspired command-line interface for Microsoft Fabric. Explore, automate, and script your Fabric environment directly from your terminal with familiar commands like ls, cd, mkdir, cp, and more.

🚀 Quick Start

# Install the CLI
pip install ms-fabric-cli

# Authenticate
fab auth login

# Start exploring
fab ls                                                           # List workspaces
fab get <workspace-name>.Workspace/<item-name>.<item-type>       # Get item properties (e.g., ws1.Workspace/nb1.Notebook)

✨ Key Features

🗂️ File-System Navigation

Navigate Microsoft Fabric like your local file system with intuitive commands:

  • ls, cd, pwd - Navigate workspaces and items
  • mkdir, rm, mv, cp - Create, delete, move, and copy items
  • exists, open - Check existence and open items in the Fabric portal

🔄 Data & Item Management

  • Import/Export items with import and export commands
  • OneLake file operations - Upload, download, and manage files
  • Table operations - Load data, optimize tables, manage schemas
  • Shortcut management - Create and manage OneLake shortcuts

🤖 Automation Ready

  • Scripting mode - Perfect for CI/CD pipelines and automation
  • Interactive mode - Live shell experience for exploration
  • Job management - Run, schedule, and monitor Fabric jobs
  • API access - Direct REST API calls with authentication handled

🔐 Flexible Authentication

  • Interactive login - Browser-based authentication
  • Service Principal - Client secrets, certificates, and federated tokens
  • Managed Identity - System and user-assigned identities
  • Environment variables - Headless authentication for automation

🌐 Cross-Platform Support

  • Windows, macOS, Linux - Native support across all platforms
  • Multiple shells - PowerShell, Bash, Zsh, and more
  • Shell completion - Autocomplete for commands and arguments (in command-line mode)

📦 Installation

Prerequisites

  • Python 3.10, 3.11, 3.12, 3.13, or 3.14
  • A Microsoft Fabric account with access to your tenant/workspaces.

Install via pip

pip install ms-fabric-cli

Upgrade existing installation

pip install --upgrade ms-fabric-cli

Verify installation

fab --version

🔐 Authentication

Interactive Login

fab auth login
# Select: "Interactive with a web browser"

Service Principal

fab auth login -u <client_id> -p <client_secret> --tenant <tenant_id>

The CLI supports additional authentication methods including certificates, managed identity, and environment variables. See the authentication documentation) for complete details.

🎯 Usage Examples

Basic Navigation

# List all workspaces
fab ls

# Navigate to a workspace
fab cd "Sales Analytics.workspace"

# List items in current workspace
fab ls -l

# Get current location
fab pwd

Working with Items

# Create a new notebook
fab mkdir MyNotebook.notebook

# Copy an item between workspaces
fab cp notebook1.notebook /TargetWorkspace.workspace/

# Export an item definition
fab export MyReport.report -o ./backup/

# Import an item
fab import NewNotebook.notebook -i ./definitions/notebook.json

OneLake File Operations

# Navigate to lakehouse files
fab cd MyLakehouse.lakehouse/Files

# Upload a file
fab cp ./local-data.csv ./remote-data.csv

# Download files
fab cp ./remote-data.csv ~/Downloads/

# List files with details
fab ls -l

Job Management

# Run a notebook synchronously
fab job run MyNotebook.notebook

# Schedule a pipeline
fab job run-sch MyPipeline.datapipeline --type daily --interval "09:00"

# Check job status
fab job run-status MyNotebook.notebook --id <job-id>

Table Operations

# Load CSV data into a table
fab table load Tables/SalesData --file Files/sales.csv --mode append

# Optimize a table
fab table optimize Tables/SalesData --vorder --zorder ProductID,Date

# View table schema
fab table schema Tables/SalesData

API Integration

# Make authenticated API calls
fab api workspaces

# Query with JMESPath
fab api workspaces -q "value[?name=='MyWorkspace']"

# POST request with data
fab api capacities -X POST -i capacity-config.json

🔧 Configuration

Interactive vs Command-Line Mode

# Switch to interactive mode
fab config set mode interactive
fab auth login  # Re-authenticate for interactive mode

# Switch back to command-line mode
fab config set mode command_line

Common Settings

# Enable debug logging
fab config set debug_enabled true

# Set default capacity
fab config set default_capacity "My Capacity"

# Configure output sorting
fab config set output_item_sort_criteria bytype

# View all settings
fab config ls

📚 Documentation

Resource Description
Command Reference Complete command documentation
Usage Examples Real-world scenarios and scripts
API Integration Direct REST API access patterns
CI/CD Integration GitHub Actions and Azure Pipelines
Settings CLI Configuration

🤝 Contributing

We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or helping other users, your contributions are valuable.

Quick Start Contributing

  1. Check existing issues - Look for issues labeled help-wanted
  2. Read our guidelines - See CONTRIBUTING.md for detailed instructions
  3. Fork and clone - Set up your development environment
  4. Create a pull request - Link it to the related issue

Before contributing, please review our Contributing Guidelines and Code of Conduct.

🆘 Support & Community

Getting Help

Feature Requests

Enterprise Support

🔄 Release Notes

See the full Release Notes for detailed changelog.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🏢 Microsoft Open Source

This project is part of Microsoft's commitment to open source. We follow Microsoft's Open Source Code of Conduct.

For questions or concerns, contact opencode@microsoft.com.


Explore, Automate, and Build with Microsoft Fabric CLI

📖 Documentation • 🐛 Report Bug • 💬 Discuss • 💡 Request Feature

Metadata

Release files for ms-fabric-cli 1.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for ms-fabric-cli 1.8.0
File Interpreter ABI Platform
ms_fabric_cli-1.8.0-py3-none-any.whl Python 3 none any Details

Release files / ms_fabric_cli-1.8.0-py3-none-any.whl

Download URL ms_fabric_cli-1.8.0-py3-none-any.whl
Size 359.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28b477a486f402e7685238bf11a58b23d84b0d54fc3e71b6406f6902e006c150
BLAKE2b-256 checksum
How to use checksums
7ec21751c39a3e77c0a0d1a989cc0b1e91c2e3f9ccdf47f755984ee93dcb4684
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for ms-fabric-cli 1.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page