Azure Databricks에 비밀을 저장하는 방법
6484 단어 databaseazuredatascience
배경
Azure Databricks에서는 다양한 Azure 서비스에 저장된 데이터에 대해 데이터 변환을 수행하는 코드를 작성할 수 있습니다. Azure Blob 저장소, Azure Synapse. 그러나 다른 프로그램에서 때때로 Azure Databricks에서 사용되는 자격 증명을 보호하려는 경우 Azure Databricks는 이를 달성하는 데 도움이 되는 견고한 비밀 관리 접근 방식을 제공합니다.
단계
Azure Cloud Shell에서 Databricks CLI(명령줄 인터페이스) 준비
Cloud Shell 환경 구성
Cloud Shell을 열고 Cloud Shell 환경으로 "Bash"를 선택했는지 확인합니다.

가상 환경 설정
아래 명령으로 가상 환경을 생성합니다.
# Bash
virtualenv -p /usr/bin/python2.7 databrickscli

가상 환경 활성화
아래 명령으로 가상 환경을 활성화하십시오.
# Bash
source databrickscli/bin/activate

Databricks CLI 설치
아래 명령으로 Databricks CLI를 설치합니다.
# Bash
pip install databricks-cli

Azure Databricks에서 비밀 만들기
인증 설정
비밀을 만들려면 먼저 Azure Databricks 작업 영역의 URL 및 토큰이 필요한 Azure Databricks의 사용자로 인증해야 합니다.
Azure Databricks 작업 영역의 URL 가져오기
Azure Databricks 작업 영역으로 이동하여 해당 URL을 복사할 수 있습니다.

Azure Databricks 작업 영역에 대한 액세스 토큰 생성
아래 단계에 따라 액세스 토큰을 검색할 수 있습니다.





비밀 범위 만들기
인증 후 먼저 여러 비밀을 그룹화할 수 있는 비밀 범위를 만들어야 합니다.
Databrick이 표준 계획에 있는 경우 동일한 작업 영역의 다른 사용자와 공유할 비밀 범위만 만들 수 있습니다.

# Bash
databricks secrets create-scope --scope <<scope>>
# Example
databricks secrets create-scope --scope storage --initial-manage-principal users # Standard Plan
databricks secrets create-scope --scope storage # Premium plan

비밀 만들기
아래 명령을 사용하여 지정된 범위에서 비밀을 만들 수 있습니다.
# Bash
databricks secrets put --scope <<scope>> --key <<key name>>
databricks secrets put --scope storage --key blob #Example


노트북에서 비밀 사용
노트북에서 아래 명령으로 비밀을 사용할 수 있습니다.
# Python
dbutils.secrets.get(scope=<<scope>>,key=<<key>>)
dbutils.secrets.get(scope=storage,key=blob) #Example

원본 게시물: https://joeho.xyz/blog-posts/how-to-store-secrets-in-azure-databricks/
Reference
이 문제에 관하여(Azure Databricks에 비밀을 저장하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/joeho888/how-to-store-secrets-in-azure-databricks-28g7텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)