Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Microsoft Fabric Backup Script

A PowerShell script to automate the backup of all items from your Microsoft Fabric workspaces locally, maintaining the original folder structure.

Overview

This script uses the official ms-fabric-cli (fab) tool to list all workspaces within a Microsoft Fabric tenant and then exports each valid item (Reports, Semantic Models, Lakehouses, Notebooks, etc.) into a specified local directory.

It handles:

  • Interactive prompts bypass (fab export).
  • Error handling for items that do not support exporting.
  • Workspace filtering based on custom text matching to avoid downloading development, trial, or temporary workspaces.

Prerequisites

Before running this script, ensure you have the following installed and configured:

  1. Python 3.10+ (must be added to your system's PATH).
  2. Microsoft Fabric CLI: Install it using pip:
    pip install ms-fabric-cli
  3. Authentication: You must log in to your tenant from the console to allow the script to access your workspaces:
    fab auth login

Usage

Simply run the script from your PowerShell console:

.\backup_fabric.ps1

By default, the script will create a FabricBackup folder in the current directory and download everything there.

Parameters

The script supports the following optional parameters to customize the backup process:

  • -BackupDirectory <String>: Specifies the main local directory path where the backup will be stored. Default is .\FabricBackup.
  • -ExcludeWorkspaces <String[]>: A list of text strings. Any workspace whose name contains one or more of these strings will be ignored and excluded from the extraction process (case-insensitive).

Examples

Exporting to a specific path:

.\backup_fabric.ps1 -BackupDirectory "C:\Backups\Fabric"

Excluding specific workspaces:

.\backup_fabric.ps1 -ExcludeWorkspaces "TEMP", "PRUEBA", "DEV"

Combining both parameters:

.\backup_fabric.ps1 -BackupDirectory ".\SmartDataSuite" -ExcludeWorkspaces "ZZZ"

How It Works

  1. Validates that the fab command is available.
  2. Lists all the accessible workspaces in the tenant using fab ls /.
  3. Filters out any workspace that matches the text in -ExcludeWorkspaces.
  4. Creates a local folder for each workspace inside the -BackupDirectory.
  5. Iterates through the items inside each workspace using fab ls /<WorkspaceName>.Workspace.
  6. Uses fab export to download the definitions, files, and metadata of each item into its corresponding local folder.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages