Introducing Fabtools – a free, open-source and community-driven PowerShell module for Microsoft Fabric and Power BI

I love to use PowerShell to automate the repetitive tasks in PowerBI! And the PowerBI module for PowerShell is fantastic. But there aren’t ready-made cmdlets for every Power BI task you want automated; sometimes you have to use the Power BI Rest API, which can get annoying to write, even if you use the Invoke-PowerBIRestMethod cmdlet.

And if you want to do some even more advanced things, like grab usage metrics data, you need to find the Cluster URI of your tenant which is hidden behind the main API address, and run API calls directly there…

So I took the matter into my own hands and made my own PowerShell module that makes some of these things quite a bit easier, plus added some cmdlets directly aimed at Microsoft Fabric administration:

Taadaa, here it is: Fabtools – Fabric Administration and Beyond. It even has a cute giraffe logo 😃

You can install it right now from the PowerShell Gallery by running the following command in PowerShell ‘Install-Module Fabtools’. Or you can grab it from GitHub. If you want to collaborate and make the module even cooler, just reach out.

So whether you’re looking to pause and resume your Fabric capacities, delve into tenant settings, quickly refresh your Fabric items or explore workspace users and user metrics, we’ve got you covered. And hey, I know that Microsoft will maybe/probably come with an official Fabric PowerShell module, but I just couldn’t wait anymore. We’ll have to see how I adjust it once Microsoft launches something official. We’ll be working on loads of new cmdlets targeting the Fabric REST API once more of the Fabric REST API endpoint become publically available, so the sky is the limit!

Now let’s talk a little bit about the most useful things that are in the module:

  1. Refreshes

The official Power BI PowerShell module doesn’t give you any info about dataset refreshes. To access this, you normally need to use ‘Invoke-PowerBIRestMethod -Method get -Url (“datasets/*datasetID*/Refreshes”)’. Fabtools makes dealing with the refreshes easier by giving you some extra cmdlets that let you skip having to look up the URI’s in the Rest API. The cmdlets for refreshes are:

Get-FabricDatasetRefreshes – This will give you the refresh history of a specific dataset.

Get-FabricWorkspaceDatasetRefreshes – This will loop through all the datasets in a given workspace, and give you the refresh history for all these datasets.

Get-AllFabricDatasetRefreshes – This will loop through all your available workspaces, and all the datasets inside them, and give you the refresh history for all of them.

Invoke-FabricDatasetRefresh – This will start a dataset refresh on the given dataset.

  1. Workspace usage metrics

If you are interested in usage metrics data, but don’t want to have to click through several menus in PowerBI/Fabric service, this is for you.

New-FabricWorkspaceUsageMetrics – This will create a usage metrics report for the given workspace

Get-FabricWorkspaceUsageMetricsData – This will get all the normal data in a usage metrics report and return it as powershell objects.

Get-fabricUsageMetricsQuery – This is used by Get-FabricWorkspaceUsageMetricsData to get all the data out, but can also be used to grab specific data out of the usage metrics report.

  1. Workspace administration

The official PowerShell module lets you do several things with Fabric Workspaces. It lets you create new workspaces and it lets you add and remove users from these workspaces. But what it doesn’t do, is give you a list of users that are in the workspace, or what roles the users have. It also doesn’t let you delete a workspace. If you’re interested in automating any of these tasks, I’ve got you:

Get-FabricWorkspaceUsers – This returns a list of users attached to a workspace, with their access levels.

Remove-FabricWorkspace – This deletes a given workspace.

  1. Fabric capacity administration

In Microsoft Fabric, you’ll have to deal with Fabric Capacities. If you want to do some cost saving with these capacities (since they are billed pr second as of now), it’s smart to be able to suspend or resume them. With help of the Azure PowerShell Module, the Azure RestAPI and the right access rights, you can now automate that with Fabtools.

Get-AllFabricCapacities – This will loop through all the Azure subscriptions you have access to, loop through all the resource groups inside of the subscriptions and find all the Fabric Capacities.

Get-FabricCapacityState – This will tell you what state a given Fabric capacity is currently in. If it is active or paused.

Suspend-FabricCapacity – This will pause a given capacity.

Resume-FabricCapacity – This will activate a given capacity.

Set-FabricWorkspaceToCapacity – This will move a workspace into a given Fabric capacity. Which is very useful if you’ve accidentally put a workspace in the wrong capacity.

  1. Tenant settings

I also made some cmdlets for the few listed Rest API endpoints in the Fabric Rest API :

Get-FabricTenantSettings – This returns all the tenant settings in Fabric. These are the general settings across the entire tenant, like who’s allowed to do what.

Get-FabricCapacityTenantOverrides – This returns a list of tenant settings that are overridden at the capacity level.

  1. Aliases

And finally, since we’re working in Fabric now, and not just Power BI, I also added a whole lot of Fabric-friendly Aliases to the existing Power BI cmdlets. So a lot of them can be accessed with Fabric or just Fab, instead of Power BI. For example Get-FabricWorkspace instead of Get-PowerBIWorkspace.

Now go install this module and use it to build something awesome! As a free, open source and community-driven project, Fabtools needs the diverse insights and innovative ideas of users like you. Whether you’re a seasoned PowerShell pro or just starting to explore its capabilities, your experience and feedback are invaluable. Test out the module and play with its features. And if you find a way to make it even better or have a cool idea brewing in your mind, reach out. That way we can make Fabtools into a powerful and user-friendly tool, made by the community, for the community.


Posted

in

,

by

Tags: