이 페이지에서는 애플리케이션 기본 사용자 인증 정보(ADC)가 사용자 인증 정보를 찾는 위치에 대해 설명합니다. ADC의 작동 방법을 알고 있으면 ADC에 사용되는 사용자 인증 정보와 이를 찾는 방법을 이해하는 데 도움이 될 수 있습니다.
Application Default Credentials (ADC) 는 애플리케이션 환경을 기준으로 사용자 인증 정보를 자동으로 검색하기 위해 인증 라이브러리에 사용되는 전략입니다. 그런 다음 인증 라이브러리는 Cloud 클라이언트 라이브러리 및 Google API 클라이언트 라이브러리에 이러한 사용자 인증 정보를 제공합니다.
ADC를 사용할 때는 Google Cloud 서비스와 API에 대한 애플리케이션 인증 방법을 변경하지 않고도 개발 또는 프로덕션 환경에서 코드를 실행할 수 있습니다.
로컬 ADC 파일 생성 방법을 포함하여 ADC에 사용자 인증 정보를 제공하는 방법에 대한 자세한 내용은 애플리케이션 기본 사용자 인증 정보 설정을 참조하세요.
ADC가 사용자 인증 정보를 확인하는 위치의 순서는 각 위치의 상대적 장점과 관련이 없습니다. ADC에 사용자 인증 정보를 제공하는 가장 좋은 방법은 애플리케이션 기본 사용자 인증 정보 설정을 참조하세요.
GOOGLE_APPLICATION_CREDENTIALS 환경 변수를 설정하여 이 코드를 App Engine 로컬 에뮬레이터에서도 사용할 수 있습니다.
GOOGLE_APPLICATION_CREDENTIALS 환경 변수를 사용하여 사용자 인증 정보 JSON 파일의 위치를 제공할 수 있습니다. 이 JSON 파일은 다음 파일 유형 중 하나일 수 있습니다.
직원 ID 제휴의 사용자 인증 정보 구성 파일
직원 ID 제휴를 사용하면 외부 ID 공급업체(IdP)를 통해 사용자를 인증하여 Google Cloud리소스에 액세스하도록 승인할 수 있습니다. 자세한 내용은 Identity and Access Management(IAM) 문서의 직원 ID 제휴를 참조하세요.
워크로드 아이덴티티 제휴의 사용자 인증 정보 구성 파일
워크로드 아이덴티티 제휴를 사용하면 외부 IdP를 사용하여Google Cloud 리소스에 액세스하도록 워크로드를 인증 및 승인할 수 있습니다. 자세한 내용은 Identity and Access Management(IAM) 문서의 클라이언트 라이브러리, gcloud CLI 또는 Terraform을 사용하여 인증을 참조하세요.
서비스 계정 키
서비스 계정 키는 보안 위험을 초래하므로 권장하지 않습니다. 다른 사용자 인증 정보 파일 유형과 달리 손상된 서비스 계정 키는 추가 정보 없이 악의적인 행위자에 의해 사용될 수 있습니다. 자세한 내용은 서비스 계정 키 사용 및 관리 권장사항을 참조하세요.
gcloud auth application-default login 명령어를 사용하여 생성된 사용자 인증 정보 파일
gcloud CLI를 사용하여 ADC에 제공하는 사용자 인증 정보는 gcloud CLI가 Google Cloud에 인증하는 데 사용하는 사용자 인증 정보인 gcloud 사용자 인증 정보와는 다릅니다. 이 두 가지 사용자 인증 정보에 대한 자세한 내용은 gcloud CLI 인증 구성 및 ADC 구성 을 참조하세요.
Google Drive와 같이 Google Cloud외부 서비스의 범위를 추가하려면 OAuth 클라이언트 ID를 만들고,
and provide it to the command by using the
–-client-id-file 플래그를 사용하여 gcloud auth application-default login 명령어에 제공하고, -–scopes 플래그를 사용하여 범위를 지정합니다.
연결된 서비스 계정
많은 Google Cloud 서비스를 통해 Google Cloud API 액세스를 위해 사용자 인증 정보를 제공하는 데 사용할 수 있는 서비스 계정을 연결할 수 있습니다. ADC가 GOOGLE_APPLICATION_CREDENTIALS 환경 변수 또는 로컬 ADC 사용자 인증 정보에 대해 잘 알려진 위치에서 사용할 수 있는 사용자 인증 정보를 찾지 못하면 메타데이터 서버를 사용하여 코드가 실행 중인 서비스에 대한 사용자 인증 정보를 가져옵니다.
연결된 서비스 계정의 사용자 인증 정보를 사용하는 것이 Google Cloud의 프로덕션 환경에서 사용자 인증 정보를 찾는 데 선호되는 방법입니다. 연결된 서비스 계정을 사용하려면 다음 단계를 따르세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eApplication Default Credentials (ADC) automatically locate credentials for your application based on its environment, allowing it to run in development or production without code changes.\u003c/p\u003e\n"],["\u003cp\u003eADC prioritizes credential locations in a specific order: the \u003ccode\u003eGOOGLE_APPLICATION_CREDENTIALS\u003c/code\u003e environment variable, a file from the \u003ccode\u003egcloud auth application-default login\u003c/code\u003e command, and lastly, an attached service account through the metadata server.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGOOGLE_APPLICATION_CREDENTIALS\u003c/code\u003e environment variable can point to credential files for Workforce Identity Federation, Workload Identity Federation, or a service account key, though service account keys are discouraged due to security risks.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud auth application-default login\u003c/code\u003e command creates a local credential file, separate from gcloud CLI credentials, in a specific location that differs based on the operating system.\u003c/p\u003e\n"],["\u003cp\u003eUsing an attached service account, accessible via the metadata server, is the recommended method for credentialing applications in a production Google Cloud environment.\u003c/p\u003e\n"]]],[],null,["This page describes the locations where Application Default Credentials (ADC)\nlooks for credentials. Understanding how ADC works can help you understand which\ncredentials ADC is using, and how it's finding them.\n\n\nApplication Default Credentials (ADC) is a strategy used by the authentication libraries\nto automatically find credentials based on the application environment. The authentication libraries\nmake those credentials available to\n[Cloud Client Libraries and Google API Client Libraries](/apis/docs/client-libraries-explained).\nWhen you use ADC, your code can run in either a development or production environment without\nchanging how your application authenticates to Google Cloud services and APIs.\n\nFor information about how to provide credentials to ADC, including how to\ngenerate a local ADC file, see\n[Set up Application Default Credentials](/docs/authentication/provide-credentials-adc).\n\nSearch order\n\nADC searches for credentials in the following locations:\n\n1. [`GOOGLE_APPLICATION_CREDENTIALS` environment variable](#GAC)\n2. [A credential file created by using the `gcloud auth application-default login` command](#personal)\n3. [The attached service account, returned by the metadata server](#attached-sa)\n\nThe order of the locations ADC checks for credentials is not related to\nthe relative merit of each location. For help with\nunderstanding the best ways to provide credentials to ADC, see\n[Set up Application Default Credentials](/docs/authentication/provide-credentials-adc).\n\nGOOGLE_APPLICATION_CREDENTIALS environment variable\n\nYou can use the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to provide\nthe location of a credential JSON file. This JSON file can be one of the\nfollowing types of files:\n\n- A credential configuration file for Workforce Identity Federation\n\n Workforce Identity Federation lets you use an external identity provider\n (IdP) to authenticate and authorize users to access Google Cloud\n resources. For more information, see\n [Workforce Identity Federation](/iam/docs/workforce-identity-federation) in the\n Identity and Access Management (IAM) documentation.\n- A credential configuration file for Workload Identity Federation\n\n Workload Identity Federation lets you use an external\n IdP to authenticate and authorize workloads to access\n Google Cloud resources. For more information, see\n [Authenticating by using client libraries, the gcloud CLI, or Terraform](/iam/docs/using-workload-identity-federation#generate-automatic)\n in the Identity and Access Management (IAM) documentation.\n- A service account key\n\n Service account keys create a security risk and are not recommended. Unlike\n the other credential file types, compromised service account keys can be\n used by a bad actor without any additional information. For more\n information, see\n [Best practices for using and managing service account keys](/iam/docs/best-practices-for-managing-service-account-keys).\n\nA credential file created by using the `gcloud auth application-default login` command\n\nYou can [provide credentials to ADC](/docs/authentication/set-up-adc-local-dev-environment) by running the\n[`gcloud auth application-default login`](/sdk/gcloud/reference/auth/application-default/login) command. This\ncommand creates a JSON file containing the credentials you provide (either from\nyour user account or from impersonating a service account) and places it in a\nwell-known location on your file system. The location depends on your\noperating system:\n\n- Linux, macOS: `$HOME/.config/gcloud/application_default_credentials.json`\n- Windows: `%APPDATA%\\gcloud\\application_default_credentials.json`\n\nThe credentials you provide to ADC by using the gcloud CLI are\ndistinct from your gcloud credentials---the credentials the\ngcloud CLI uses to authenticate to Google Cloud. For more\ninformation about these two sets of credentials, see\n[gcloud CLI authentication configuration and ADC configuration](/docs/authentication/gcloud#gcloud-credentials).\n\n\nBy default, the access tokens generated from a local ADC file created with user credentials include\nthe [cloud-wide scope `https://www.googleapis.com/auth/cloud-platform`](/docs/authentication#authorization-gcp).\nTo specify scopes explicitly, you use the\n[`---scopes` flag](/sdk/gcloud/reference/auth/application-default/login#--scopes)\nwith the `gcloud auth application-default login` command.\n\n\nTo add scopes for services outside of Google Cloud, such as Google Drive,\n[create an OAuth Client ID](https://support.google.com/cloud/answer/6158849)\nand provide it to the `gcloud auth application-default login` command by using the\n[`---client-id-file` flag](/sdk/gcloud/reference/auth/application-default/login#--client-id-file), specifying\nyour scopes with the [`---scopes` flag](/sdk/gcloud/reference/auth/application-default/login#--scopes).\n\n\nThe attached service account\n\nMany Google Cloud services let you attach a service account that can be\nused to provide credentials for accessing Google Cloud APIs. If ADC does\nnot find credentials it can use in either the `GOOGLE_APPLICATION_CREDENTIALS`\nenvironment variable or the well-known location for local ADC credentials,\nit uses the [metadata server](/compute/docs/metadata/overview) to get credentials for the\nservice where the code is running.\n\nUsing the credentials from the attached service account is the preferred method\nfor finding credentials in a production environment on Google Cloud. To\nuse the attached service account, follow these steps:\n\n1. Create a user-managed service account.\n2. Grant that service account the [least privileged](/iam/docs/using-iam-securely#least_privilege) IAM roles possible.\n3. Attach the service account to the resource where your code is running.\n\nFor help with creating a service account, see\n[Creating and managing service accounts](/iam/docs/service-accounts-create). For help with attaching\na service account, see [Attaching a service account to a resource](/iam/docs/attach-service-accounts#attaching-to-resources).\nFor help with determining the required IAM roles for your service\naccount, see [Choose predefined roles](/iam/docs/choose-predefined-roles).\n\nWhat's next\n\n- Learn the best ways to [provide credentials to ADC](/docs/authentication/provide-credentials-adc).\n- [Authenticate using the Cloud Client Libraries](/docs/authentication/client-libraries).\n- Explore [authentication methods](/docs/authentication).\n- Learn about [client libraries](/apis/docs/client-libraries-explained)."]]