Aracılığıyla paylaş


PowerShell ile OneLake'i yönetme

Microsoft OneLake, veri okuma, yazma ve yönetim için Azure PowerShell modülüyle tümleşir.

Azure PowerShell ile OneLake'e bağlanma

Aşağıdaki adımları izleyerek PowerShell'den OneLake'e bağlanın:

  1. Azure Depolama PowerShell modülünü yükleyin.

    Install-Module Az.Storage -Repository PSGallery -Force
    
  2. Azure hesabınızda oturum açın.

    Connect-AzAccount
    
  3. Depolama hesabı bağlamını oluşturun.

    • Depolama hesabı adı onelake'dir.
    • Azure kimlik bilgilerinizi iletmek için -UseConnectedAccount olarak ayarlayın.
    • olarak -endpointayarlayınfabric.microsoft.com.
  4. Azure Data Lake Storage (ADLS) 2. Nesil için kullanılan komutları çalıştırın. ADLS 2. Nesil ve Azure Depolama PowerShell modülü hakkında daha fazla bilgi için bkz. ADLS 2. Nesil'i yönetmek için PowerShell kullanma.

Örnek: Bir öğenin veya dizinin boyutunu alma

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"