Edit

Share via


Create a SQL database with the Fabric CLI

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:

Create a new SQL database with Fabric CLI

  1. Sign in to Microsoft Fabric. Open a command prompt and run the following command:

    fab auth login 
    
  2. Follow the prompts to authenticate using your Microsoft account with access to your Fabric workspace.

  3. 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
    
  4. 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.