Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ScottBlevins
New Member

Using a GUID for DataLake in Powershell

How can a GUID be used in the code below instead of a Workspace Name?  Our workspaces have business freindly names.

 

I have tried simpy changing "myworkspace" to a real GUID in our tennant.  I have even tried to create the variable as GUID type.  I have tried all lower case letters in the GUID and all upper case letters in the GUID.

 

The error is:

 

Get-AzDataLakeGen2ChildItem : WorkspaceId and ArtifactId should be either valid Guids or valid Names
Status: 400 (BadRequest)
ErrorCode: BadRequest
Content:
{"error":{"code":"BadRequest","message":"WorkspaceId and ArtifactId should

 

https://learn.microsoft.com/en-us/fabric/onelake/onelake-powershell

Install-Module Az.Storage -Repository PSGallery -Force
Connect-AzAccount
$ctx = New-AzStorageContext -StorageAccountName 'onelake' -UseConnectedAccount -endpoint 'fabric.microsoft.com'

# This example uses the workspace and item name. If the workspace name does not meet Azure Storage naming criteria (no special characters), you can use GUIDs instead.
$workspaceName = 'myworkspace'
$itemPath = 'mylakehouse.lakehouse/Files'

# Recursively get the length of all files within your lakehouse, sum, and convert to GB.
$colitems = Get-AzDataLakeGen2ChildItem -Context $ctx -FileSystem $workspaceName -Path $itemPath -Recurse -FetchProperty | Measure-Object -property Length -sum
"Total file size: " + ($colitems.sum / 1GB) + " GB"

1 ACCEPTED SOLUTION
ScottBlevins
New Member

Resolved by MS support at my employer.  If you use a workspace GUID, then you must also use a Lakehouse GUID.  I was using only the workspace GUID due to the name being incompatible.

 

To use the Workspace GUID in the Get-AzDataLakeGen2ChildItem cmdlet, you must also use the Lakehouse GUID instead of the Lakehouse name.


The Workspace GUID and Lakehouse GUID can be retrieved by:
Go to the workspace > Your Lakehouse > Open > URL: https://app.powerbi.com/groups/<workspaceGUID>/lakehouses/<LakehouseGUID>?experience=power-bi
Ensure that Lakehouse is selected at the top right hand side

View solution in original post

1 REPLY 1
ScottBlevins
New Member

Resolved by MS support at my employer.  If you use a workspace GUID, then you must also use a Lakehouse GUID.  I was using only the workspace GUID due to the name being incompatible.

 

To use the Workspace GUID in the Get-AzDataLakeGen2ChildItem cmdlet, you must also use the Lakehouse GUID instead of the Lakehouse name.


The Workspace GUID and Lakehouse GUID can be retrieved by:
Go to the workspace > Your Lakehouse > Open > URL: https://app.powerbi.com/groups/<workspaceGUID>/lakehouses/<LakehouseGUID>?experience=power-bi
Ensure that Lakehouse is selected at the top right hand side

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.