一部の Google Cloud リソースでは、リソースがデフォルトの ID として使用するユーザー管理のサービス アカウントを指定できます。このプロセスは、サービス アカウントをリソースに「接続する」、またはサービス アカウントとリソースを「関連付ける」といいます。リソースで実行されているコードが Google Cloud のサービスとリソースにアクセスすると、そのリソースに関連付けられているサービス アカウントが ID として使用されます。たとえば、サービス アカウントを Compute Engine インスタンスに接続し、そのインスタンスのアプリケーションがクライアント ライブラリを使用して Google Cloud APIs を呼び出す場合、これらのアプリケーションは、認証と認可に接続されたサービス アカウントを自動的に使用します。
GKE で実行されるワークロードの場合、Workload Identity Federation for GKE を使用すると、クラスタ内のアプリケーションごとに、個々のきめ細かいプリンシパル セットに対して IAM ロールを付与できます。Workload Identity Federation for GKE を使用すると、GKE クラスタ内の Kubernetes サービス アカウントが Workforce Identity 連携を使用して Google Cloudリソースに直接アクセスすることや、IAM サービス アカウントの権限を借用して間接的にアクセスすることが可能になります。
リソースへの直接アクセスを使用すると、 Google Cloud サービスのリソースで Kubernetes サービス アカウント ID に IAM ロールを直接付与できます。ほとんどの Google Cloud API は、リソースへの直接アクセスをサポートしています。ただし、ID 連携を使用すると、一部の API メソッドに制限が適用される場合があります。これらの制限の一覧については、サポートされているプロダクトと制限事項をご覧ください。
別の方法として、ワークロードでサービス アカウントの権限を借用することもできます。この場合、構成された Kubernetes ServiceAccount は IAM サービス アカウントにバインドされ、 Google CloudAPIs へのアクセス時に ID として機能します。
Workload Identity 連携を使用すると、AWS、Azure、Active Directory などの外部 ID プロバイダの認証情報を使用して有効期間の短い認証情報を生成できます。ワークロードは、この認証情報を使用して、サービス アカウントの権限を一時的に借用できます。これにより、ワークロードはサービス アカウントを ID として Google Cloudリソースにアクセスできるようになります。
外部ワークロードの ID を構成する場合は、Workload Identity 連携を使用することをおすすめします。
[[["わかりやすい","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-11 UTC。"],[],[],null,["# Identities for workloads\n\nThis page describes the identity types that you can use to configure\nyour workloads' access to Google Cloud resources.\n\nGoogle Cloud provides the following types of identities for workloads:\n\n- [**Workload Identity Federation**](/iam/docs/workload-identity-federation) and\n [**Workload Identity Federation for GKE**](/kubernetes-engine/docs/concepts/workload-identity) let your workloads access\n most Google Cloud services by using federated identities that are\n authenticated through an external identity provider (IdP). After\n Google Cloud authenticates the identity as a principal, the principal\n can access resources by using IAM roles that you grant.\n\n- [**Google Cloud service accounts**](/iam/docs/service-account-overview) can act as\n identities for workloads in production environments. Instead of granting access\n to a workload directly, you grant access to a service account, then have the\n workload use the service account as its identity.\n\n- [**Managed workload identities**](/iam/docs/managed-workload-identity) [(Preview)](/products#product-launch-stages)\n let you bind strongly attested identities to your Compute Engine and\n GKE workloads.\n\nThe types of identities that you can use for workloads and the way that you\nconfigure them depends on where your workloads are running.\n\nConfigure workloads on Google Cloud\n-----------------------------------\n\nIf you're running workloads on Google Cloud, you can use the following\nmethods to configure identities for your workloads:\n\n- Attached service accounts\n- Workload Identity Federation for GKE (for workloads running on Google Kubernetes Engine only)\n- Managed workload identities (for workloads that run on Compute Engine and GKE only)\n- Service account keys\n\n### Attached service accounts\n\n\nFor some Google Cloud resources, you can specify a user-managed service account that the\nresource uses as its default identity. This process is known as *attaching* the service\naccount to the resource, or *associating* the service account with the resource.\n\n\nWhen code running on the resource accesses Google Cloud services and resources, it uses the\nservice account attached to the resource as its identity. For example, if you [attach a\nservice account to a Compute Engine instance](/compute/docs/access/service-accounts#associating_a_service_account_to_an_instance), and the applications on the instance use a [client library](/apis/docs/client-libraries-explained) to call Google Cloud APIs,\nthose applications automatically use the attached service account for authentication and\nauthorization.\n\nIn most cases, you must attach a service account to a resource when you create\nthat resource. After the resource is created, you cannot change which service\naccount is attached to the resource. Compute Engine instances are an\nexception to this rule; you can change which service account is attached to an\ninstance as needed.\n\nTo learn more, see [Attach a service account to a resource](/iam/docs/attach-service-accounts).\n\n### Workload Identity Federation for GKE\n\nFor workloads that run on GKE, Workload Identity Federation for GKE lets you\ngrant IAM roles to distinct, fine-grained sets of principals, for\neach application in your cluster. Workload Identity Federation for GKE lets Kubernetes\nservice accounts in your GKE cluster access Google Cloud\nresources directly, by using Workload Identity Federation, or indirectly,\nby using IAM service account impersonation.\n\nBy using direct resource access, you can grant IAM roles to the\nKubernetes service account identity directly on the Google Cloud service's\nresources. Most Google Cloud APIs support direct resource access. However,\nwhen using identity federation, certain API methods might have limitations. For\na list of these limitations, see [Supported products and limitations](/iam/docs/federated-identity-supported-services).\n\nAs an alternative, workloads can also use service account impersonation, where\nthe configured Kubernetes ServiceAccount is bound to an IAM\nservice account, which serves as the identity when accessing Google Cloud\nAPIs.\n\nTo learn more about GKE Workload Identity Federation for GKE, see\n[Workload Identity Federation for GKE](/kubernetes-engine/docs/concepts/workload-identity).\n\n### Managed workload identities\n\n|\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the\n| General Service Terms section of the\n| [Service Specific Terms](/terms/service-terms#1).\n| Pre-GA features are available \"as is\" and might have limited support. For more\n| information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nManaged workload identities let you bind strongly attested identities to your\nCompute Engine and GKE workloads. You can use managed\nworkload identities to authenticate your workloads to other workloads using\n[mTLS](https://en.wikipedia.org/wiki/Mutual_authentication).\n\nTo learn more about managed workload identities, and how to configure platforms\nto use them, see [Managed workload identities overview](/iam/docs/managed-workload-identity).\n\nConfigure external workloads\n----------------------------\n\nIf you're running workloads outside of Google Cloud, you can use the\nfollowing methods to configure identities for your workloads:\n\n- Workload Identity Federation\n- Service account keys\n\n### Workload Identity Federation\n\nYou can use Workload Identity Federation with workloads on\nGoogle Cloud or external workloads that run on platforms such as AWS,\nAzure, GitHub, and GitLab.\n\nWorkload Identity Federation lets you use credentials from external identity\nproviders like [AWS, Azure](/iam/docs/workload-identity-federation-with-other-clouds), and [Active Directory](/iam/docs/workload-identity-federation-with-active-directory)\nto generate short-lived credentials, which workloads can use to temporarily\nimpersonate service accounts. Workloads can then access Google Cloud\nresources, using the service account as their identity.\n\nWorkload Identity Federation is the preferred way to configure identities for\nexternal workloads.\n\nTo learn more about Workload Identity Federation, see\n[Workload Identity Federation](/iam/docs/workload-identity-federation).\n\n### Service account keys\n\n\nA service account key lets a workload authenticate as a service account, then\nuse the service account's identity for authorization.\n| **Note:** Service account keys are a security risk if not managed correctly. You should [choose a more secure alternative to service account keys](/docs/authentication#auth-decision-tree) whenever possible. If you must authenticate with a service account key, you are responsible for the security of the private key and for other operations described by [Best practices for managing service account keys](/iam/docs/best-practices-for-managing-service-account-keys). If you are prevented from creating a service account key, service account key creation might be disabled for your organization. For more information, see [Managing secure-by-default organization resources](/resource-manager/docs/secure-by-default-organizations).\n|\n|\n| If you acquired the service account key from an external source, you must validate it before use.\n| For more information, see [Security requirements for externally sourced credentials](/docs/authentication/external/externally-sourced-credentials).\n\n\u003cbr /\u003e\n\nLocal development\n-----------------\n\nIf you're developing in a local environment, you can configure workloads to use\neither your user credentials or a service account for authentication and\nauthorization. For more information, see\n[Local development environment](/docs/authentication/set-up-adc-local-dev-environment) in the authentication documentation.\n\nWhat's next\n-----------\n\n- Learn how to [set up authentication by using service accounts](/docs/authentication#service-accounts).\n- Learn how to [set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n- Learn how to [grant service accounts access to resources](/iam/docs/granting-changing-revoking-access)."]]