이 문서에서는 Cloud Functions v2 API(예: gcloud functions, REST API, Terraform 사용)를 사용하여 만든 함수를 호출하는 방법에 관한 추가 정보를 제공합니다. 자세한 정보와 예시는 Cloud Run 요청 인증 가이드를 참조하세요. Cloud Run 가이드에서 다루는 주제는 Cloud Functions v2 API를 사용하여 만든 함수에도 적용됩니다. v2 함수도 Cloud Run 호출자 역할(roles/run.invoker)을 사용하기 때문입니다.
인증된 함수를 호출하려면 기본 주 구성원이 다음 요구사항을 충족해야 합니다.
함수를 호출할 수 있는 권한이 있음
함수를 호출할 때 ID 토큰을 제공함
Cloud Run Functions는 주 구성원이라고도 하는 두 가지 종류의 ID를 지원합니다.
서비스 계정: 함수, 애플리케이션, VM과 같이 사람이 아닌 사용자의 ID로 사용되는 특수 계정입니다. 이런 계정은 비인간 사용자를 인증하는 방법을 제공합니다.
사용자 계정: 개인 Google 계정 소유자 또는 Google 그룹처럼 Google이 관리하는 항목에 속하는 사용자 등 인간이 사용하는 계정입니다.
함수에 대한 다른 관리 작업을 생성, 업데이트, 수행할 권한을 위해서는 주 구성원에게 적절한 역할이 있어야 합니다. 역할에는 주 구성원이 수행할 수 있는 작업을 정의하는 권한이 포함됩니다. 자세한 내용은 IAM을 사용하여 액세스 승인을 참조하세요.
이벤트 기반 함수는 구독 중인 이벤트 소스에서만 호출할 수 있습니다. 하지만 HTTP 함수는 함수를 테스트하는 개발자나 함수를 사용하는 다른 서비스와 같이 다른 위치에서 시작되는 다양한 ID 유형으로 호출할 수 있습니다. ID는 인증을 위해 ID 토큰을 제공해야 합니다. 사용 중인 계정에도 적절한 권한이 있어야 합니다.
[[["이해하기 쉬움","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-03(UTC)"],[[["\u003cp\u003eTo invoke an authenticated Cloud Run function, the principal must have the \u003ccode\u003erun.routes.invoke\u003c/code\u003e permission, typically through the Cloud Run Invoker role, and provide an ID token.\u003c/p\u003e\n"],["\u003cp\u003ePrincipals can be service accounts (for non-persons like functions or applications) or user accounts (for individual Google Account holders or groups), both requiring appropriate permissions to invoke functions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can test functions by assigning the Cloud Run Invoker role to their user account, using the Google Cloud CLI to generate ID tokens for requests, and allocating the minimum required permissions to operate.\u003c/p\u003e\n"],["\u003cp\u003eFor function-to-function calls, grant the calling function's service account the Cloud Run Invoker role on the receiving function's service, ensuring the calling function provides a Google-signed ID token.\u003c/p\u003e\n"],["\u003cp\u003eID tokens can be generated programmatically using authentication libraries or manually by using the Compute metadata server or exchanging a self-signed JWT for a Google-signed ID token, with the latter two methods being more complex.\u003c/p\u003e\n"]]],[],null,["# Authenticate for invocation\n===========================\n\nThis document provides supplemental information on how to invoke functions\ncreated using the\n[Cloud Functions v2 API](/functions/docs/apis)---for example, using\n`gcloud functions`, the REST API, or Terraform. For detailed information and\nexamples, see the Cloud Run\n[Authenticate requests](/run/docs/authenticating/overview) guides. The topics\ncovered in the Cloud Run guides also apply to functions created using the\n[Cloud Functions v2 API](/functions/docs/apis), since v2 functions also\nuse the\n[Cloud Run Invoker role](/run/docs/reference/iam/roles#run.invoker)\n(`roles/run.invoker`).\n\nTo invoke an authenticated function, the underlying\n**principal** must meet the following requirements:\n\n- Have permission to invoke the function.\n- Provide an ID token when it invokes the function.\n\nCloud Run functions supports two different kinds of identities, which are also\ncalled **principals**:\n\n- Service accounts: These are special accounts that serve as the identity of a non-person, like a function or an application or a VM. They give you a way to authenticate these non-persons.\n- User accounts: These accounts represent people, either as individual Google Account holders or as part of a Google-controlled entity like a Google Group.\n\nSee the [IAM overview](/iam/docs/overview) to learn more about\nbasic IAM concepts.\n\nTo invoke an authenticated function, the principal must have the invoker\nIAM **permission**:\n\n- `run.routes.invoke`. This is usually through the [Cloud Run Invoker role](/run/docs/reference/iam/roles#run.invoker). This permission must be assigned on the Cloud Run service resource.\n\nTo grant these permissions, follow the steps in the\nCloud Run\n[Authenticating service-to-service](/run/docs/authenticating/service-to-service#set-up-sa) guide.\n\nFor permission to create, update, or perform other administrative actions on a\nfunction, the principal must have an appropriate **role** . Roles include permissions that define the actions that the principal is allowed to do. See\n[Using IAM to Authorize Access](/functions/docs/securing/managing-access-iam)\nfor more information.\n\nEvent-driven functions can only be invoked by the event source that they're\nsubscribed to. HTTP functions, however, can be invoked by different identity\ntypes originating from different places, such as by a developer testing the\nfunction or by another service using the function. Identities must provide an ID\ntoken for authentication. The account in use must also have the appropriate\npermissions."]]