Fabric CLI Explained: Install, Use, and Connect It to GitHub Copilot

There are multiple ways you can connect AI to Power BI and Microsoft Fabric. You could use MCP servers, you could use Fabric Skills, but there’s also another way: Fabric CLI, the command line interface. It’s not used as much as the other methods, but it’s quite powerful. In this post, I’ll first show you what CLI is in general, how to download, install, and use it, even without Copilot or any AI at all, and then I’ll connect it to GitHub Copilot so you can see how AI can run those CLI commands for you.


What Is Fabric CLI (Video: 0:53)

CLI stands for command line interface. There are CLI tools available for pretty much anything. There’s a CLI for Azure, giving you the ability to run commands against Azure, list your resources, check your subscription. There are CLI commands for different actions inside Windows, for Office 365, and there’s also a set of CLI commands for Fabric, called Fabric CLI.

A command line interface gives you a place to run commands specifically working with an environment or setting. Fabric CLI gives you a set of commands to connect to your Fabric workspaces and your Fabric environment. For example, you can list your Fabric workspaces with a simple command like fab ls, or copy the content of one workspace to another with a command like fab cp. It makes things much simpler than doing a lot of actions manually.

Here’s the important part: CLI itself doesn’t need AI at all. You can use it entirely on its own, without worrying about token optimization or anything like that, because it isn’t AI.

Installing Fabric CLI with Python and pip (Video: 2:12)

The install command is pip install ms-fabric-cli, run inside your command line. If you get a message that “pip is not a recognized command,” that’s because pip is a Python command, and you need Python installed first. Go to python.org, download the installer, and install it. Once Python is installed, that pip command should run fine inside your normal Windows command line interface.

You can also use pip install for many other CLI tools, I’ve used the same approach to install the CLI used for Microsoft events, like the one for Microsoft Build. Once you run pip install ms-fabric-cli, it takes a little time, but installs the Fabric CLI library for you.

Fixing the Fab Login Path Issue (Video: 4:25)

Once installed, you can run Fabric CLI commands like fab login. In my case, that didn’t immediately work, the path it installed to didn’t line up correctly with the environment variable, which should normally happen automatically but didn’t on my system.

The fix: find the installation path, change the last part of it to “Scripts,” that’s the folder containing the fab.exe file, then create a new environment variable pointing to that path. Go to Edit Environment Variables, User Variables, find Path, click Edit, and add a new entry with that Scripts folder path. Click OK on all the windows to save, close your command prompt, and reopen it so the new system variable takes effect.

Logging In and Checking Authentication Status (Video: 6:03)

With the path fixed, running fab login this time actually responds. It asks whether you want to use a service account or log in through a web browser. I used the browser for this demo, but a service account is genuinely useful if you want to automate the process later.

Once logged in, you can check your authentication status with fab auth status, which shows you which tenant you’re logged into, your account details, and a partial view of your token (not the full thing, for security reasons).

Exploring Commands: List Workspaces, Export, and Help (Video: 7:13)

Fabric CLI commands all start with fab. fab ls gives you a list of your workspaces. I’d strongly recommend checking the official Fabric CLI documentation, it covers every available command and exactly what information each one gives you.

You can also add -h (help) after any command, like fab ls -h, to get information on how that specific command works before you run it for real. Want a list of every item inside a specific workspace? Use fab ls <workspace-name>.workspace. Just typing fab on its own lists every available command. -h gives help, and -v (version) shows you the CLI version you have installed.

Why Use CLI Without AI at All (Video: 8:52)

This is genuinely helpful even before AI enters the picture. You don’t need AI for any of this, you won’t use any tokens, and it costs you nothing beyond your own time. You can automate your process, write a script that grabs a list of items from one workspace and copies them into another, effectively building your own deployment pipeline. There are a lot of interesting scenarios here purely with plain CLI scripting.

Connecting AI: GitHub Copilot and Fabric CLI Together (Video: 9:14)

Now for the more interesting part: bringing AI into this. I switch to VS Code, a free developer tool, with GitHub Copilot configured. Before writing any prompts, I make sure I’m not using any MCP server tools or Fabric Skills for this demo, every checkbox unchecked, so what you’re seeing is CLI plus AI specifically, not MCP.

My prompt: “use Fabric CLI to give me list of workspaces.” Sometimes Copilot doesn’t immediately understand what “Fabric CLI” refers to, so I pass along the CLI documentation directly in the prompt. This is exactly where a custom skill file becomes genuinely useful, if you save that documentation into a skill once, you don’t need to paste it into every prompt, which also means far less token usage overall.

Once it understands, Copilot runs fab auth status itself, confirms the same output I saw manually earlier, then runs fab ls to actually answer my prompt. You can watch all of this happen directly in the terminal window inside VS Code, and the result matches exactly what I have in my real Fabric environment.

Exporting a Workspace with a Single Prompt (Video: 11:22)

Next prompt: I ask Copilot to download the content of a specific workspace into a local folder with the same name, inside my Downloads folder. This is essentially exporting everything exportable, reports, semantic models, lakehouses, warehouses, notebooks.

Copilot runs fab export -h first to understand the command, then executes the actual export. And this is genuinely better than doing it manually myself, it creates the destination folder automatically and runs the export command without me lifting a finger beyond the prompt. Watching it work through a fairly large workspace, roughly 80 items exported, semantic model definitions, reports, and more, all from one sentence.

Creating a New Workspace via Prompt (Video: 13:09)

Next, I point Copilot at the CLI documentation examples for working with workspaces (again, ideally something you’d bake into a custom skill file rather than repeat each time) and ask it to create a new Fabric workspace called SD2.

The first attempt fails, Copilot didn’t include the capacity name. But it recognizes the error and retries with the capacity name included, and the workspace gets created successfully. Checking the actual Fabric environment confirms it: the new SD2 workspace exists, correctly associated with the right Fabric capacity. If you have multiple capacities, you can specify exactly which one to use directly in your prompt.

Copying Content Between Workspaces (and Watching AI Adapt) (Video: 15:12)

Next prompt: copy the entire content from one workspace to another, using fab cp based on the documentation Copilot already has. This time I deliberately made the scenario a bit harder, and when the straightforward approach failed, Copilot adapted: it wrote a for-each loop, essentially a small program that iterates through every item in the source workspace and copies each one individually to the destination.

This is the real power of combining CLI with AI, it’s not just running the commands, it can write the program for you when the simple path doesn’t work, instead of you having to go research and figure that out yourself. You could prompt for something like a scheduled deployment pipeline script, copy content from one workspace, move it to another, update the connections, and all of it is achievable with just CLI and AI, no MCP server, no Fabric Skills required.

Summary

There are plenty of different ways to connect AI to your Microsoft Fabric environment. In this one, I covered Fabric CLI specifically, how to install it, configure it, run it entirely on its own, and finally connect it to GitHub Copilot. The same approach works with Claude Code or Codex too, not just Copilot. Go try Fabric CLI in your own environment, and if you have questions, drop them in the comments, I read every one.


About Reza Rad

Reza Rad is a Microsoft Regional Director and a 16-year consecutive Microsoft Data Platform MVP, recognized as one of the world’s leading voices on Power BI and Microsoft Fabric. He is co-founder of RADACAD, a Microsoft Gold Partner delivering Power BI and Fabric consulting and training to organizations across 80+ countries, and co-founder of the Difinity Conference and the Power BI & Fabric Summit. Reza has authored more than 10 books on Power BI and Microsoft BI technologies, published over 1,000 technical articles, and personally trained thousands of data professionals worldwide. Whether you need a full analytics architecture built from the ground up, a stuck DAX formula or performance issue solved, or a team trained from the basics to advanced Fabric implementation, Reza and the RADACAD team offer both hands-on consulting and structured training to get you there. Learn more at radacad.com.


Reza Rad on FacebookReza Rad on LinkedinReza Rad on TwitterReza Rad on Youtube
Reza Rad
Trainer, Consultant, Mentor
Reza Rad is a Microsoft Regional Director, an Author, Trainer, Speaker and Consultant. He has a BSc in Computer engineering; he has more than 20 years’ experience in data analysis, BI, databases, programming, and development mostly on Microsoft technologies. He is a Microsoft Data Platform MVP for 12 continuous years (from 2011 till now) for his dedication in Microsoft BI. Reza is an active blogger and co-founder of RADACAD. Reza is also co-founder and co-organizer of Difinity conference in New Zealand, Power BI Summit, and Data Insight Summit.
Reza is author of more than 14 books on Microsoft Business Intelligence, most of these books are published under Power BI category. Among these are books such as Power BI DAX Simplified, Pro Power BI Architecture, Power BI from Rookie to Rock Star, Power Query books series, Row-Level Security in Power BI and etc.
He is an International Speaker in Microsoft Ignite, Microsoft Business Applications Summit, Data Insight Summit, PASS Summit, SQL Saturday and SQL user groups. And He is a Microsoft Certified Trainer.
Reza’s passion is to help you find the best data solution, he is Data enthusiast.
His articles on different aspects of technologies, especially on MS BI, can be found on his blog: https://radacad.com/blog.

Leave a Reply

Your email address will not be published. Required fields are marked *