Mengelola OneLake dengan PowerShell
Microsoft Fabric OneLake terintegrasi dengan modul Azure PowerShell untuk pembacaan, penulisan, dan manajemen data.
Koneksi ke OneLake dengan Azure PowerShell
Koneksi ke OneLake dari PowerShell dengan mengikuti langkah-langkah berikut:
Menginstal modul PowerShell Azure Storage.
Install-Module Az.Storage -Repository PSGallery -Force
Masuk menggunakan akun Azure Anda.
Connect-AzAccount
Buat konteks akun penyimpanan.
- Nama akun penyimpanan adalah onelake.
- Atur
-UseConnectedAccount
ke passthrough kredensial Azure Anda. - Atur
-endpoint
sebagaifabric.microsoft.com
.
Jalankan perintah yang sama yang digunakan untuk Azure Data Lake Storage (ADLS) Gen2. Untuk informasi selengkapnya tentang ADLS Gen2 dan modul Azure Storage PowerShell, lihat Menggunakan PowerShell untuk mengelola ADLS Gen2.
Contoh: Mendapatkan ukuran item atau direktori
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"