Storage 자격 증명

적용 대상:check marked yes Databricks SQL check marked yes Databricks 런타임 check marked yes Unity 카탈로그만

Unity Catalog 및 기본 제공 Azure Databricks Hive 메타스토어는 관리되는 테이블의 기본 위치를 사용합니다. Unity Catalog는 클라우드 개체 스토리지의 데이터에 권한을 부여하기 위해 몇 가지 새로운 보안 개체를 도입했습니다.

스토리지 자격 증명

스토리지 자격 증명은 Azure 관리 ID 또는 Microsoft Entra ID 서비스 주체를 나타내는 보안 개체입니다.

스토리지 자격 증명이 만들어지면 보안 주체 (사용자 및 그룹)에 액세스 권한을 부여할 수 있습니다.

스토리지 자격 증명은 주로 특정 스토리지 경로에 대한 액세스 범위를 지정하는 외부 위치를 만드는 데 사용됩니다.

스토리지 자격 증명 이름은 정규화되지 않았으며 메타스토어 내에서 고유해야 합니다.

관계의 그래픽 표현

다음 다이어그램은 다음 간의 관계를 설명합니다.

  • 스토리지 자격 증명
  • 외부 위치:
  • 외부 테이블
  • 스토리지 경로
  • IAM 엔터티
  • Azure 서비스 계정

External location ER diagram

예제

CLI를 사용하여 Microsoft Entra ID 서비스 주체에 대한 스토리지 자격 증명 my_azure_storage_cred 을 만듭니다.

databricks storage-credentials create --json '{"name": "my_azure_storage_cred", "azure_service_principal": {"directory_id": "12345678-9abc-def0-1234-56789abcdef0", "application_id": "23456789-9abc-def0-1234-56789abcdef0", "client_secret": "Cli3nt5ecr3t"}}'

나머지 명령은 SQL 내에서 실행할 수 있습니다.

-- Grant access to the storage credential
> GRANT READ FILES ON STORAGE CREDENTIAL my_azure_storage_cred TO ceo;

-- ceo can directly read from any storage path using myazure_storage_cred
> SELECT count(1) FROM `delta`.`abfss://container@storageaccount.dfs.core.windows.net/depts/finance/forecast/somefile` WITH (CREDENTIAL my_azure_storage_cred);
  100
> SELECT count(1) FROM `delta`.`abfss://container@storageaccount.dfs.core.windows.net/depts/hr/employees` WITH (CREDENTIAL my_azure_storage_cred);
  2017

-- Create an external location on specific path to which `my_azure_storage_cred` has access
> CREATE EXTERNAL LOCATION finance_loc URL 'abfss://container@storageaccount.dfs.core.windows.net/depts/finance'
    WITH (CREDENTIAL my_azure_storage_cred)
    COMMENT 'finance';