When you refer to a principal in an Identity and Access Management (IAM) policy, you need to use the correct identifier for the principal. The format of the identifier depends on the type of principal you want to refer to and the type of policy you're writing.
This page lists the identifier formats for each policy type's supported principal types.
Principal identifiers for allow policies
The following table describes the principal identifiers for allow
policies, which use the IAM v1
API.
These identifiers are also used for Privileged Access Manager entitlements.
Principal type | Identifier |
---|---|
Service account |
Example: |
All service accounts in a project, folder, or organization |
Example for all service accounts in a project: Example for all service accounts in all projects in a folder: Example for all service accounts in all projects in an organization: |
All users | allUsers |
All authenticated users | allAuthenticatedUsers |
Single identity in a workforce identity pool |
principal://iam.googleapis.com/locations/global/workforcePools/POOL_ID/subject/SUBJECT_ATTRIBUTE_VALUE
Example: |
All workforce identities in a group |
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/group/GROUP_ID
Example using a group email:
Example using a group UUID: |
All workforce identities with a specific attribute value |
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/attribute.ATTRIBUTE_NAME/ATTRIBUTE_VALUE
Example: |
All identities in a workforce identity pool |
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/*
Example: |
Single identity in a workload identity pool | principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT_ATTRIBUTE_VALUE |
Workload identity pool group | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/group/GROUP_ID |
All identities in a workload identity pool with a certain attribute | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/attribute.ATTRIBUTE_NAME/ATTRIBUTE_VALUE |
All identities in a workload identity pool | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/* |
All GKE Pods that use a specific Kubernetes service account |
By service account name:
By service account ID:
Legacy format: |
All GKE Pods in a Kubernetes namespace, regardless of service account or cluster | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/PROJECT_ID./namespace/NAMESPACE |
All GKE Pods in a specific cluster | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/PROJECT_ID./kubernetes.cluster/https://container.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/clusters/CLUSTER_NAME |
Deleted service account1 |
Example: |
Deleted single identity in a workforce identity pool1 |
Example: |
1 Don't add deleted principals when creating or modifying policies.
Principal identifiers for deny policies
The following table describes the principal identifiers for deny
policies, which use the IAM v2
API.
Principal type | Identifier |
---|---|
Service account |
Example: |
All service accounts in a project, folder, or organization |
Example for all service accounts in a project: Example for all service accounts in all projects in a folder: Example for all service accounts in all projects in an organization: |
All service agents associated with a project, folder, or organization |
Example for all service agents associated with a project or its descendants: Example for all service agents associated with a folder or its descendants: Example for all service agents associated with an organization or its descendants: |
All principals | principalSet://goog/public:all |
Single identity in a workforce identity pool |
principal://iam.googleapis.com/locations/global/workforcePools/POOL_ID/subject/SUBJECT_ATTRIBUTE_VALUE
Example: |
All workforce identities in a group |
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/group/GROUP_ID
Example using a group email:
Example using a group UUID: |
All workforce identities with a specific attribute value |
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/attribute.ATTRIBUTE_NAME/ATTRIBUTE_VALUE
Example: |
All identities in a workforce identity pool |
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/*
Example: |
Single identity in a workload identity pool | principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT_ATTRIBUTE_VALUE |
Workload identity pool group | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/group/GROUP_ID |
All identities in a workload identity pool with a certain attribute | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/attribute.ATTRIBUTE_NAME/ATTRIBUTE_VALUE |
All identities in a workload identity pool | principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/* |
Deleted service account2 |
Example: |
Deleted single identity in a workforce identity pool2 |
Example: |
1 Learn how to find your Cloud Identity customer ID.
2 Don't add deleted principals when creating or modifying policies.