Public/Get-FabricLakehouse.ps1
Function Get-FabricLakehouse { <# .SYNOPSIS Retrieves Fabric lakehouse(s) from a specified workspace. .DESCRIPTION The Get-FabricLakehouse function retrieves information about lakehouses within a Microsoft Fabric workspace. If a specific lakehouse name is provided, the function returns details for that lakehouse only. The function requires both the workspace name and lakehouse name parameters. .PARAMETER workspaceName The name of the Fabric workspace containing the lakehouse(s). .PARAMETER lakehouseName The name of the specific lakehouse to retrieve from the workspace. .EXAMPLE Get-FabricLakehouse -workspaceName "Marketing" -lakehouseName "CustomerData" Retrieves details of the "CustomerData" lakehouse in the "Marketing" workspace. .OUTPUTS System.Object Returns an object containing details about the specified lakehouse. .NOTES This function requires the Get-FabricWorkspace and Invoke-FabricApiRequest functions. The user must have appropriate permissions to access the specified workspace and lakehouse. #> [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$workspaceName, [Parameter(Mandatory)] [string]$lakehouseName ) $workspace = Get-FabricWorkspace -workspaceName $workspaceName $result = Invoke-FabricApiRequest -Uri "workspaces/$($workspace.id)/lakehouses" -Method Get if ($lakehouseName) { $lakehouse = $result | ? { $_.displayName -ieq $lakehouseName } if (!$lakehouse) { throw "Cannot find lakehouse '$lakehouseName'" } Write-Output $lakehouse } else { Write-Output $result } } |