Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✅ SQL database in Microsoft Fabric
You can use the Fabric Command Line Interface (CLI) to create SQL databases in Fabric. The Fabric CLI (fab
) is a fast, file‑system‑inspired command‑line interface for Microsoft Fabric.
This article and sample scripts demonstrate the basic Fabric CLI commands that can be used to deploy a Fabric SQL database.
Prerequisites
Before you begin:
You need an existing Fabric capacity. If you don't, start a Fabric trial.
- Make sure that you Enable SQL database in Fabric using Admin Portal tenant settings. If you don't, you receive an error message "SQL database failed to create."
You can use an existing workspace or create a new Fabric workspace.
You must be a member of the Admin or Member roles for the workspace to create a SQL database.
Make sure Python version 3.10, 3.11, or 3.12 is installed on your machine. Python should be accessible from your terminal, via the
PATH
environment variable.Install Fabric CLI on your machine with the following command. If you see a message about updating the
PATH
in the output of the installer, fix that before proceeding or subsequent steps can fail.pip install ms-fabric-cli
Create a new SQL database with Fabric CLI
Sign in to Microsoft Fabric. Open a command prompt and run the following command:
fab auth login
Follow the prompts to authenticate using your Microsoft account with access to your Fabric workspace.
Run the following command to create a new SQL database:
- Replace
<workspacename>
with the name of the workspace where you want to create the SQL database. - Replace
<databasename>
with the name that you want to use for your new SQL database.
fab create <workspacename>.Workspace/<databasename>.SQLDatabase
- Replace
Verify the new SQL database in your workspace with the following command:
- Replace
<workspacename>
with the name of the workspace where you want to create the SQL database.
fab ls <workspacename>.Workspace
The
fab ls
command displays a list of all items in the workspace, including your new SQL database.- Replace