Google Cloud Tutorial · Identity and Access · Lesson 10 of 27

Organisation Policies and Security Services

Guardrails that apply regardless of IAM, and the core security services: Secret Manager, Cloud KMS, VPC Service Controls and Security Command Center.

Members can save this page, take notes and track progress. See membership · Sign in

Organisation policies

IAM says who can act; organisation policies say what configurations are allowed at all, for everyone, inherited down the hierarchy. Common constraints:

Constraint Effect
iam.disableServiceAccountKeyCreation no downloadable service account keys
gcp.resourceLocations resources only in approved regions (data residency)
compute.vmExternalIpAccess no public IPs on VMs
storage.publicAccessPrevention buckets can't be made public
iam.allowedPolicyMemberDomains roles only for identities in your domains

Test changes in dry-run mode before enforcing them on existing projects.

Security services

  • Secret Manager: store secrets (API keys, passwords) with versions and IAM; workloads read them at run time.
  • Cloud KMS: manage encryption keys; CMEK lets you encrypt storage, BigQuery and databases with your own key.
  • VPC Service Controls: perimeters around Google APIs to stop data leaving, even with valid credentials.
  • Security Command Center: findings for misconfigurations, vulnerabilities and threats across the organisation.
  • Cloud Audit Logs: who did what, when (Admin Activity logs are always on).
Organisation policies rejecting configurationsTry it yourself
policies = {
    "gcp.resourceLocations": {"europe-west1", "europe-west4"},
    "compute.vmExternalIpAccess": False,
    "storage.publicAccessPrevention": True,
}
requests = [
    {"type": "vm", "region": "europe-west1", "external_ip": False},
    {"type": "vm", "region": "us-central1", "external_ip": False},
    {"type": "vm", "region": "europe-west4", "external_ip": True},
    {"type": "bucket", "region": "europe-west1", "public": True},
]
for r in requests:
    problems = []
    if r["region"] not in policies["gcp.resourceLocations"]:
        problems.append("location not allowed")
    if r.get("external_ip") and not policies["compute.vmExternalIpAccess"]:
        problems.append("external IP blocked")
    if r.get("public") and policies["storage.publicAccessPrevention"]:
        problems.append("public access prevented")
    print(r["type"], r["region"], "->", ", ".join(problems) or "allowed")

Output

vm europe-west1 -> allowed
vm us-central1 -> location not allowed
vm europe-west4 -> external IP blocked
bucket europe-west1 -> public access prevented

Test yourself

An engineer has the Owner role but can't create a VM with a public IP. Why?

  1. Owner can't create VMs
  2. An organisation policy blocks external IPs, whatever IAM allows
  3. Public IPs need billing approval
  4. VMs can never have public IPs
Show answer

Answer: An organisation policy blocks external IPs, whatever IAM allows

Organisation policies restrict configurations for everyone, including Owners.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake