FabricTools
Automate Microsoft Fabric and Power BI administration from PowerShell.
📖 Documentation ·
🚀 Quick start ·
📝 Changelog ·
📊 Cmdlet maturity
FabricTools gives you more than 200 cmdlets to manage Microsoft Fabric from a script or a pipeline: workspaces, capacities, items such as lakehouses, warehouses, notebooks and data pipelines, Git integration, deployment pipelines, connections, schedules and tenant settings. It works with Windows PowerShell 5.1 and PowerShell 7 on Windows and Linux.
[!NOTE]
FabricTools is in public preview. Cmdlets are still changing between releases, and not all of them are equally mature. Check the cmdlet maturity report to see how well each cmdlet is tested before you rely on it in production.
Quick start
# Install from the PowerShell Gallery
Install-Module FabricTools -Scope CurrentUser
# Sign in (opens the interactive account picker)
Connect-FabricAccount -TenantId '<tenant-id>'
# Explore
$workspace = Get-FabricWorkspace -WorkspaceName 'Sales'
Get-FabricLakehouse -WorkspaceId $workspace.id
The access token is checked before every call and, by default, renewed automatically when it expires, so long-running scripts keep working.
What you can do
Each area links to its cmdlets on the documentation website, where you can search every cmdlet and see its syntax, parameters and examples.
| Area |
Examples |
| Workspaces |
Create and update workspaces, manage role assignments, assign capacities |
| Capacities |
List capacities and SKUs, suspend and resume, check workloads |
| Items |
Lakehouses, warehouses, notebooks, data pipelines, semantic models, reports, KQL databases, eventhouses, eventstreams, environments, Spark job definitions, ML models and more |
| Git integration |
Connect a workspace to Git, check status, commit and update |
| Deployment pipelines |
Create pipelines, assign stages and deploy content |
| Domains and tenant |
Organise workspaces into domains, read and override tenant settings |
| Core |
Sign-in, connections, and Invoke-FabricRestMethod for any Fabric API not yet covered by a cmdlet |
Signing in
Connect-FabricAccount supports interactive sign-in, device code and service principals.
# Interactive user sign-in
Connect-FabricAccount -TenantId '<tenant-id>'
# Device code, for terminals that cannot show the account picker
Connect-FabricAccount -UseDeviceAuthentication
# Service principal: the username is the application (client) ID, the password is the client secret
$credential = Get-Credential -UserName '<app-id>' -Message 'Client secret'
Connect-FabricAccount -TenantId '<tenant-id>' -Credential $credential
Examples
Pause and resume a capacity
$capacity = @{
SubscriptionID = '<subscription-id>'
ResourceGroup = 'rg-fabric'
Capacity = 'fabriccapacity01'
}
Suspend-FabricCapacity @capacity
Resume-FabricCapacity @capacity
Run a data pipeline and wait for it to finish
$run = @{
WorkspaceId = $workspace.id
DataPipelineName = 'Daily load'
Parameters = @{ loadDate = (Get-Date -Format 'yyyy-MM-dd') }
}
Start-FabricDataPipeline @run
Commit workspace changes to Git
Get-FabricGitStatus -WorkspaceId $workspace.id -ChangesOnly
Invoke-FabricGitCommit -WorkspaceId $workspace.id -Comment 'Nightly sync'
Assign workspaces to a capacity
$capacity = Get-FabricCapacity -CapacityName 'fabriccapacity01'
Get-FabricWorkspace |
Where-Object displayName -like 'Sales*' |
ForEach-Object { Add-FabricWorkspaceCapacity -WorkspaceId $_.id -CapacityId $capacity.id }
Call any Fabric REST API
Invoke-FabricRestMethod -Uri 'workspaces' -Method Get
Requirements
- Windows PowerShell 5.1 or PowerShell 7+, on Windows or Linux
- A Microsoft Fabric or Power BI tenant, and permissions for the objects you manage
- An Azure subscription, only for the capacity cmdlets that use Azure Resource Manager (for example
Suspend-FabricCapacity)
- The modules Az.Accounts, Az.Resources and PSFramework, which are installed automatically by
Install-Module FabricTools
Contributing
Contributions are welcome. Pull requests target the develop branch.
git clone https://github.com/dataplat/FabricTools.git
cd FabricTools
./build.ps1 -ResolveDependency -Tasks noop # first time only
./build.ps1 -Tasks build, test
See CONTRIBUTING.md for the development workflow and conventions, and the Code of Conduct for how we work together.
Authors
In alphabetical order:
- Tiago Balabuch (tiagobalabuch): wrote most of the cmdlets and made the module robust and well organised
- Ioana Bouariu (Jojobit): initial work
- Frank Geisler (Frank-Geisler): Real-Time Intelligence cmdlets
- Kamil Nowinski (NowinskiK): refactoring, unification and further cmdlets
- Jess Pomfret (jpomfret): automation and PowerShell expertise
- Rob Sewell (SQLDBAWithABeard): automation, DevOps, governance and experience from dbatools
See also everyone who has contributed.
Acknowledgments
License
FabricTools is licensed under the MIT License.
Star history