使用 PowerShell 管理 OneLake
Microsoft Fabric OneLake 會與 Azure PowerShell 模組整合,以進行數據讀取、寫入和管理。
使用 Azure PowerShell 連線 至 OneLake
請遵循下列步驟,從 PowerShell 連線 至 OneLake:
安裝 Azure 儲存體 PowerShell 模組。
Install-Module Az.Storage -Repository PSGallery -Force
登入您的 Azure 帳戶。
Connect-AzAccount
建立記憶體帳戶內容。
- 儲存體 帳戶名稱為 onelake。
- 設定
-UseConnectedAccount
為傳遞您的 Azure 認證。 - 設定
-endpoint
為fabric.microsoft.com
。
執行用於 Azure Data Lake 儲存體 (ADLS) Gen2 的相同命令。 如需ADLS Gen2和 Azure 儲存體PowerShell模組的詳細資訊,請參閱使用PowerShell來管理ADLS Gen2。
範例:取得專案或目錄的大小
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"
相關內容
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應