Zdieľať cez


Spravovanie služby OneLake pomocou prostredia PowerShell

Microsoft Fabric OneLake sa integruje s modulom Azure PowerShell na čítanie, písanie a správu údajov.

Pripojenie do služby OneLake pomocou prostredia Azure PowerShell

Pripojenie z prostredia PowerShell do onelakeu nasledujúcim postupom:

  1. Nainštalujte modul PowerShell ukladacieho priestoru platformy Azure.

    Install-Module Az.Storage -Repository PSGallery -Force
    
  2. Prihláste sa do konta Azure.

    Connect-AzAccount
    
  3. Vytvorte kontext konta úložiska.

    • Názov konta úložiska je onelake.
    • Nastavte -UseConnectedAccount na odovzdávanie poverení Azure.
    • Nastavte -endpoint ako fabric.microsoft.com.
  4. Spustite rovnaké príkazy ako v službe Azure Data Lake Storage (ADLS) Gen2. Ďalšie informácie o službe ADLS Gen2 a module PowerShell služby Azure Storage nájdete v téme Spravovanie služby ADLS Gen2 pomocou prostredia PowerShell.

Príklad: Získanie veľkosti položky alebo adresára

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"