In this blog post, I will be sharing a PowerShell script that uploads files to a OneLake Lakehouse.
This is the script:
The script is downloadable at the bottom of the page as a txt file.
To use the script there are few steps:
Install the Powershell module Az.Storage. This code exists in the script and just needs to be uncommented for the first run, if the module is not already installed.
Fill in the variables at the top of the script:
- tenantID – Get it from – https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView
- workspaceGUID – Go to the Lakehouse in the Fabric portal. The URL should be like the one pictured below. workspaceGUID is in yellow.
- lakehouseGUID – Go to the Lakehouse in the Fabric portal. The URL should be like the one pictured below. lakehouseGUID is in red.
- localFolderPath – The local folder which contains the files to be uploaded.
- localFiles – List of files to be uploaded, to upload an entire folder’s contents leave this blank.
- uploadFolderPath – The directory path for file to be uploaded to. Leave as ‘/Files/’ for root folder.
Once the variables have been completed you can run the script, an Azure login prompt should appear.
After logging in, the files should upload into OneLake storage.
Please download the script using this link – OneLake Lakehouse Upload Script