Share via


PowerShell을 사용하여 OneLake 관리

Microsoft Fabric OneLake는 데이터 읽기, 쓰기 및 관리를 위해 Azure PowerShell 모듈과 통합됩니다.

Azure PowerShell을 사용하여 OneLake에 커넥트

다음 단계를 수행하여 PowerShell에서 OneLake로 커넥트.

  1. Azure Storage PowerShell 모듈을 설치합니다.

    Install-Module Az.Storage -Repository PSGallery -Force
    
  2. Azure 계정에 로그인합니다.

    Connect-AzAccount
    
  3. 스토리지 계정 컨텍스트를 만듭니다.

    • 스토리지 계정 이름은 onelake입니다.
    • Azure 자격 증명을 통과하도록 설정합니다 -UseConnectedAccount .
    • fabric.microsoft.com설정합니다-endpoint.
  4. ADLS(Azure Data Lake Storage) Gen2에 사용되는 것과 동일한 명령을 실행합니다. ADLS Gen2 및 Azure Storage 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"