Data Bear

Microsoft Fabric CLI: Automate Workspaces, Pipelines & Data

Power BI Box plots

The world of data just got a lot more efficient. If you’ve ever wished for a faster, more automated way to interact with Microsoft Fabric  without clicking endlessly through the UI your wish is granted. The Microsoft Fabric Command-Line Interface (CLI), now generally available, brings powerful automation and scripting capabilities right to your terminal.

Whether you’re building data pipelines, managing Lakehouses, or just love a good CLI workflow, this guide will show you how to get started, run real commands, and automate your Fabric environment in minutes.

What Is the Microsoft Fabric CLI?

The Microsoft Fabric CLI is a command-line utility that lets you interact with Fabric resources using scripts and terminal commands. Announced as generally available at Microsoft Build, this tool is perfect for developers and data engineers who want to streamline tasks like creating workspaces, deploying pipelines, managing Lakehouses, and more.

Step-by-Step: Installing and Logging into the Fabric CLI

Before you can use the CLI, you’ll need Python installed. Once that’s ready:

  1. Install the CLI:
    pip install ms-fabric-cliInstall the CLI
    
  2. Login using the CLI:
    fab auth loginLogin using the CL
    

    You can choose between interactive login, service principal, or managed identity. For first-timers, interactive login is quick and easy.

  3. Switch to Interactive Mode:
    To simplify repeated commands:

    fab config set mode=interactive
    fab auth loginSwitch to Interactive Mode:
    
    

    This opens a shell-style environment where you can issue commands without typing fab each time.

Exploring and Managing Workspaces

Once logged in, you can list and manage Fabric resources.

View Existing Workspaces
lsView Existing Workspaces
Create a New Workspace

You must specify a capacity:

mkdir newproject5 --capacity-id <YourCapacityName>

Find your capacity ID using:

capacity listCreate a New Workspace
Copying Pipelines Between Workspaces

Want to duplicate a Pipeline from one workspace to another? With the CLI, it’s just one command:

cp ContosoWarehouseParts/IngestData newproject5/IngestData

This command copies the Pipeline from the original workspace into your new one. No manual recreation or Git integration required.Copying Pipelines Between Workspaces

Automating Lakehouse Creation and Data Loading
Create a New Lakehouse
lakehouse create lh1
Run a Pipeline with Parameters

Use environment variables or parameters for automation:

pipeline run IngestData --parameters lakehouseid=<GUID>
Monitor Pipeline Status
pipeline job status <job-id>

Monitor Pipeline Status Microsoft Fabric CLI

You can script this to poll for completion or failure and trigger follow-up actions automatically.

Explore Data with the CLI

Once your Lakehouse is populated:

  • List tables:
    lakehouse table list
    
  • View table schema:
    lakehouse table schema products
    

This lets you explore your data model right from the command line, enabling fast debugging and validation.Explore Data with the CLI Microsoft Fabric CLI

Why Use the Fabric CLI?
  • Speed: Faster than navigating the UI.
  • Automation: Script tasks for CI/CD or scheduled jobs.
  • Consistency: Avoid human error by using repeatable scripts.
  • Innovation: Perfect for developers integrating Fabric into modern data workflows.

As APIs evolve, so will this CLI. The team is actively working on enhancements, and early adopters are already reporting major productivity boosts.

Try It Yourself

If you’re using Fabric for data integration, pipeline automation, or Lakehouse management, the Fabric CLI is a must-have tool. It’s especially powerful for enterprise teams looking to standardize and automate their development pipelines.

: Explore parameters and environment variables to build flexible scripts that can be reused across multiple environments.

Learn More and Share Your Feedback

Want to go deeper into Microsoft Fabric and automation? Explore more at Advanced Power BI Training.