144. Google Drive 서비스 계정 인증 설정 (Set up service account authentication)
- 원문: English
- 위치: Additional capabilities › Knowledge Bases › Build a managed knowledge base › Create a managed knowledge base › Connect a data source › Google Drive › Set up service account authentication
한 줄 요약
Google Cloud 서비스 계정 + JSON 개인 키 + 도메인 전체 위임(domain-wide delegation) + 위임용 관리자 사용자를 준비해 adminAccountEmail, clientEmail, privateKey를 Secrets Manager에 저장합니다. ACL을 지원하는 유일한 방식입니다.
쉽게 말하면
서비스 계정이 “관리자 대신” Drive를 읽도록 Workspace에서 허락해 주는 과정입니다. Google 쪽은 Workspace 관리자, AWS 쪽은 Secrets Manager·IAM 관리자 권한이 필요합니다.
핵심 내용
설정 단계
| 단계 | 할 일 |
|---|---|
| 1. 프로젝트 생성 | Google Cloud 콘솔에서 New Project |
| 2. API 활성화 | Google Drive API, Google Drive Activity API, Admin SDK API |
| 3. 서비스 계정 생성 | APIs & Services › Credentials › Service account. Unique ID 복사 |
| 4. 개인 키 생성 | Keys › Create new key › JSON → client_email, private_key 포함 파일 다운로드 |
| 5. 도메인 전체 위임 | Workspace Admin Console › Security › Access and data control › API controls › Manage Domain Wide Delegation. Client ID = Unique ID, 아래 scope 입력 |
| 6. 위임 관리자 사용자 생성 | 전용 사용자 권장. 역할: Groups Reader, User Management Admin, Storage Admin |
| 7. 시크릿 생성 | 아래 JSON |
- 📝 키 생성이 조직 정책으로 막혀 있으면 프로젝트에서
iam.disableServiceAccountKeyCreation제약을 재정의해야 합니다.
도메인 전체 위임 OAuth scope
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/admin.directory.group.readonly
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/forms.body.readonly
(실제 입력은 쉼표로 구분)
시크릿 형식
{
"adminAccountEmail": "admin@your-domain.com",
"clientEmail": "your-sa@your-project.iam.gserviceaccount.com",
"privateKey": "<JSON 키 파일의 private_key>"
}
- ⚠️
privateKey에 있는 리터럴\n이스케이프는 그대로 두세요. - 시크릿 ARN → 데이터 소스
secretArn,authType=SERVICE_ACCOUNT→ 146
SA 관점
- 위임 scope에
cloud-platform이 포함되어 있어 보안팀 검토 대상이 될 수 있습니다. 원문 목록을 근거로 제시하고, 위임 관리자 사용자는 전용 계정·최소 역할로 분리하세요. - JSON 개인 키는 장기 자격 증명입니다. 키 교체 시 시크릿의
privateKey를 갱신해야 하며, 교체 누락 시 ACL 사용자 전원이 거부될 수 있습니다(147).