Azure Fabric Resource Deployment with PowerShell and REST APIs

Fabric being one of the trending buzz words these days, I’m pretty sure you might have been those lucky few who tried automating fabric resource deployment using Bicep and thought ‘Wait, what? How do I go about deploying resources beyond fabric capacity?’. Well, you’re not alone. Microsoft Fabric resources don’t yet have full native support in tools like Azure PowerShell or Bicep. Instead, they expose REST APIs.

Now, what if we were to automate Microsoft Fabric deployments using these tools? Given Fabric exposes its functionalities via REST API, next step is to develop a logic to generate these REST API payloads and deploy key Fabric resources like Workspaces, Lakehouses, and Warehouses, all driven by CI/CD pipelines and declarative parameters. This is what a custom AzFabricTools powershell module will do for us!

    • Generating valid payloads for Fabric resources

    • Sending REST API requests using PowerShell

    • Enabling repeatable, idempotent deployments

In this post, we’ll break down the structure and purpose of this module functions to help others understand, extend, or reuse them.

Module Structure

The module is organized into a standard PowerShell module layout:

AzFabricTools/
├── AzFabricTools.psd1 # Module manifest (metadata, exported functions)
└── AzFabricTools.psm1 # Module implementation (actual functions)

Core Functions

Below are the core functions available as part of AzFabricTools module.

  1. Payload Generation (New-AzFabricPayloads)
  2. Resource Deployment
    • Deploys a workspace using Payload + API Token (New-AzFabricWorkspace)
    • Deploys a lakehouse using WorkspaceId + Payload + API Token (New-AzFabricLakehouse)
    • Deploys a warehouse using WorkspaceId + Payload + API Token (New-AzFabricWarehouse)

Now, let’s talk about what these functions do at a very high level.

New-AzFabricPayloads

This function generates REST API payload objects for Workspace, Lakehouse, and Warehouse based on user supplied input.

				
					function New-AzFabricPayloads {
[CmdletBinding()]
param (
[string]$WorkspaceName,
[string]$WorkspaceDescription,
[string]$CapacityId,
[string]$WorkspaceRoleAssignments,
[string]$LakehouseName,
[string]$LakehouseDescription,
[string]$WarehouseName,
[string]$WarehouseDescription
)

#Generate and return workspace payload

if ($WorkspaceName) {
# JSON REST API Payload Template → ConvertFrom-Json → Set values
return $wsPayload
}

#Generate and return lakehouse payload

if ($LakehouseName) {
# JSON REST API Payload Template → ConvertFrom-Json → Set values
return $lhPayload
}

#Generate and return warehouse payload

if ($WarehouseName) {
# JSON REST API Payload Template → ConvertFrom-Json → Set values
return $whPayload
}
}

				
			

New-AzFabricWorkspace

Deploys a Fabric Workspace using the generated payload and an API token.

				
					function New-AzFabricWorkspace {
[CmdletBinding()]
param (
[Parameter(Mandatory)] $Payload,
[Parameter(Mandatory)] [string]$WorkspaceName,
[Parameter(Mandatory)] [string]$FabricApiToken
)

#Build URI

$uri = "https://api.fabric.microsoft.com/v1/workspaces"

# Send POST request with bearer token

Invoke-RestMethod -Uri $uri -Method POST -Body ($Payload | ConvertTo-Json) -Headers @{
Authorization = "Bearer $FabricApiToken"
 }

}
				
			

New-AzFabricLakehouse

Deploys a Lakehouse under a specific Workspace using the generated payload and an API token.

				
					function New-AzFabricLakehouse {
[CmdletBinding()]
param (
[Parameter(Mandatory)] $Payload,
[Parameter(Mandatory)] [string]$WorkspaceId,
[Parameter(Mandatory)] [string]$FabricApiToken
)

# Build URI

$uri = "https://api.fabric.microsoft.com/v1/workspaces/$WorkspaceId/lakehouses"

# Send POST request with bearer token

Invoke-RestMethod -Uri $uri -Method POST -Body ($Payload | ConvertTo-Json -Depth 10) -Headers @{
Authorization = "Bearer $FabricApiToken"
 }
 }
				
			

New-AzFabricWarehouse

Deploys a Warehouse under a specific Workspace using the generated payload and an API token.

				
					function New-AzFabricWarehouse {
[CmdletBinding()]
param (
[Parameter(Mandatory)] $Payload,
[Parameter(Mandatory)] [string]$WorkspaceId,
[Parameter(Mandatory)] [string]$FabricApiToken
)

# Build URI

$uri = "https://api.fabric.microsoft.com/v1/workspaces/$WorkspaceId/warehouses"

# Send POST request with bearer token

Invoke-RestMethod -Uri $uri -Method POST -Body ($Payload | ConvertTo-Json -Depth 10) -Headers @{
Authorization = "Bearer $FabricApiToken"

}
 }
				
			

Example Usage

				
					#Generate payloads
$workspacepayload = New-AzFabricPayloads -WorkspaceName "DemoWS" -WorkspaceDescription "Test" -CapacityId "abc123"

#Create the workspace
New-AzFabricWorkspace -Payload $workspacepayload -WorkspaceName "DemoWS" -FabricApiToken $token
				
			

Final Thoughts

The AzFabricTools module is designed for flexibility, automation, and integration into larger platform deployments. By abstracting REST API calls behind clean, parameterized functions, teams can rapidly deploy Microsoft Fabric environments using Infrastructure as Code principles.

Stay tuned for more walkthroughs on integrating this module with Azure DevOps pipelines and parameterized environments.

Read more recent blogs

Get started on the right path to cloud success today. Our Crew are standing by to answer your questions and get you up and running.