# Custom constraint limiting IAM role grants to organization members

Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.

Custom constraint limiting IAM role grants to organization members is a Google Cloud guardrail written in custom organization policy constraints. A custom constraint on iam.googleapis.com/AllowPolicy that permits an IAM allow policy only if every member is in the organization principal set, or is allUsers or allAuthenticatedUsers.

```yaml
name: organizations/ORGANIZATION_ID/customConstraints/custom.allowInternalAndSpecialIdentitiesOnly
resourceTypes: iam.googleapis.com/AllowPolicy
methodTypes:
- CREATE
- UPDATE
condition:
 "resource.bindings.all(
 binding,
 binding.members.all(member,
 (
 MemberInPrincipalSet(member, ['//cloudresourcemanager.googleapis.com/organizations/ORG_ID'])
 ||
 MemberSubjectMatches(member, ['allUsers', 'allAuthenticatedUsers'])
 )
 )
 )"
actionType: ALLOW
displayName: Only allow organization members, allusers, and allAuthenticatedUsers to be granted roles
```

- **Blocks:** A custom constraint on iam.googleapis.com/AllowPolicy that permits an IAM allow policy only if every member is in the organization principal set, or is allUsers or allAuthenticatedUsers.
- **Breaks:** Google documents that with the ALLOW action every case not explicitly listed in the condition is blocked, so any other member type in an allow policy is refused. ([source](https://cloud.google.com/resource-manager/docs/organization-policy/restricting-domains))
- **Test before applying:** Google documents Policy Simulator for Organization Policy, which previews the impact of a new custom constraint before it is enforced, and org policies in dry-run mode. ([source](https://cloud.google.com/policy-intelligence/docs/test-organization-policies))
- **Mechanism:** [Custom organization policy constraints](/mechanisms/custom-org-policy/): Fields of resource types in services that support custom constraints, in the organization where the constraint is created.
- **Taken from:** [provider documentation](https://cloud.google.com/resource-manager/docs/organization-policy/restricting-domains), provider documentation

## What the source says

"For example, the following condition expression restricts role grants to members in your organization, allUsers , and allAuthenticatedUsers :" (read 10 Nov 2026).

On what it breaks: "The allow action means that if the condition evaluates to true, the operation to create or update the resource is permitted. This also means that every other case except the one explicitly listed in the condition is blocked."

## Related guardrails

- [Deny AWS RAM sharing with external accounts](/guardrails/aws-scp-deny-ram-external-sharing/): AWS, Service control policies (SCPs), data exfiltration
- [Block public sharing of EBS snapshots (declarative policy)](/guardrails/aws-declarative-snapshot-block-public-access/): AWS, Declarative policies, data exfiltration
- [Storage SAS tokens should adhere to 7 day maximum validity](/guardrails/azure-policy-storage-sas-7-days/): Azure, Azure Policy (built-in definitions), data exfiltration
- [Domain restricted sharing](/guardrails/gcp-orgpolicy-domain-restricted-sharing/): Google Cloud, Organization Policy Service (managed and legacy constraints), data exfiltration
- [Service perimeter around managed services](/guardrails/gcp-vpcsc-service-perimeter/): Google Cloud, VPC Service Controls (service perimeters), data exfiltration
- [Allowed destinations for exporting resources](/guardrails/gcp-orgpolicy-allowed-export-destinations/): Google Cloud, Organization Policy Service (managed and legacy constraints), data exfiltration

## Related pages

- [Principal access boundary limiting the resources principals can access (Google Cloud Principal access boundary (PAB) policies)](/guardrails/gcp-pab-eligible-resources/)
- [Enforce public access prevention on Cloud Storage (Google Cloud Organization Policy Service)](/guardrails/gcp-orgpolicy-storage-public-access-prevention/)
- [Restrict public IP access on Cloud SQL instances (Google Cloud Organization Policy Service)](/guardrails/gcp-orgpolicy-sql-restrict-public-ip/)

## Sources

- Custom constraint limiting IAM role grants to organization members: https://cloud.google.com/resource-manager/docs/organization-policy/restricting-domains (read 10 Nov 2026)
- How to test it first: https://cloud.google.com/policy-intelligence/docs/test-organization-policies (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/gcp-custom-allow-internal-and-special-identities/
