共用方式為


使用 PowerShell 管理 OneLake

Microsoft Fabric OneLake 會與 Azure PowerShell 模組整合,以進行數據讀取、寫入和管理。

使用 Azure PowerShell 連線 至 OneLake

請遵循下列步驟,從 PowerShell 連線 至 OneLake:

  1. 安裝 Azure 儲存體 PowerShell 模組。

    Install-Module Az.Storage -Repository PSGallery -Force
    
  2. 登入您的 Azure 帳戶。

    Connect-AzAccount
    
  3. 建立記憶體帳戶內容。

    • 儲存體 帳戶名稱為 onelake
    • 設定 -UseConnectedAccount 為傳遞您的 Azure 認證。
    • 設定 -endpointfabric.microsoft.com
  4. 執行用於 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"