Use for time-bound access, environment-specific access
Key Concepts
Principal — who (user, service account, group, domain, allUsers)
Permission — what action (bigquery.tables.get)
Role — collection of permissions
Policy binding — {principal: role} attached to a resource
Deny policy — explicitly denies (overrides allow)
Checklist
Least privilege applied (predefined > basic roles)?
Service accounts are per-workload (not shared)?
No service account keys (use Workload Identity or metadata server)?
IAM conditions used for time-bound or environment access?
Org policies enforce guardrails at org/folder level?
IAM audit logs (Cloud Audit Logs) enabled?
Output Format
🔴 Critical — roles/owner or roles/editor on service accounts, service account keys committed to code
🟡 Warning — shared service accounts across services, no org policies for guardrails
🟢 Suggestion — Workload Identity Federation instead of SA keys for CI/CD
Exam Tips
Basic roles (Owner/Editor/Viewer) → avoid; use predefined for least privilege
Service account keys = high risk; prefer Workload Identity or metadata server credentials
IAM is inherited from parent → grant at lowest appropriate level
Deny policies = explicitly deny overrides all allows (use for guaranteed denial)
Org Policy ≠ IAM; Org Policy = what CAN be done (guardrails); IAM = who CAN do it
allUsers / allAuthenticatedUsers = public access; audit carefully
1---2name: cloud-iam3description: Cloud IAM4---56# Cloud IAM78## When to Use9- Designing access control for GCP resources10- Configuring service accounts and Workload Identity Federation11- Setting org policies for compliance12- Preparing for GCP Professional Cloud Security or DevOps Engineer exam1314## Core Jobs1516### 1. IAM Role Types17| Type | Description | Example |18|------|-------------|---------|19| **Basic** | Project-wide: Owner, Editor, Viewer | roles/editor |20| **Predefined** | Service-specific, fine-grained | roles/bigquery.dataViewer |21| **Custom** | User-defined combination of permissions | custom/myRole |22- Always prefer **predefined** over basic; use **custom** only when predefined is too broad2324### 2. Service Account Best Practices25- One service account per workload (not shared across services)26- Grant only required roles (least privilege)27- No service account keys if possible — use Workload Identity instead28- Rotate keys every 90 days if keys are required29- Disable unused service accounts3031### 3. Resource Hierarchy + IAM Inheritance32- Organization → Folder → Project → Resource33- IAM policies are inherited down the hierarchy34- Lower levels can only ADD permissions, not remove inherited ones35- Grant at lowest level possible (project or resource, not org)36- Use **folders** to group projects by team/environment3738### 4. Org Policies39- **Org Policy Service** — enforces guardrails across all projects in org40- Common policies: `constraints/compute.requireShieldedVm`, `constraints/iam.disableServiceAccountKeyCreation`41- Policies applied at org/folder/project level; inherited by children4243### 5. Workload Identity Federation44- Allow external identities (AWS, GitHub Actions, Azure AD) to access GCP without keys45- External token → exchanged for short-lived GCP credentials via STS46- Eliminates need for long-lived service account keys for CI/CD and cross-cloud4748### 6. IAM Conditions49- Add attribute-based conditions to IAM bindings50- Examples: `request.time < timestamp`, `resource.name.startsWith("projects/prod")`51- Use for time-bound access, environment-specific access5253## Key Concepts54- **Principal** — who (user, service account, group, domain, allUsers)55- **Permission** — what action (`bigquery.tables.get`)56- **Role** — collection of permissions57- **Policy binding** — {principal: role} attached to a resource58- **Deny policy** — explicitly denies (overrides allow)5960## Checklist61- [ ] Least privilege applied (predefined > basic roles)?62- [ ] Service accounts are per-workload (not shared)?63- [ ] No service account keys (use Workload Identity or metadata server)?64- [ ] IAM conditions used for time-bound or environment access?65- [ ] Org policies enforce guardrails at org/folder level?66- [ ] IAM audit logs (Cloud Audit Logs) enabled?6768## Output Format69- 🔴 **Critical** — `roles/owner` or `roles/editor` on service accounts, service account keys committed to code70- 🟡 **Warning** — shared service accounts across services, no org policies for guardrails71- 🟢 **Suggestion** — Workload Identity Federation instead of SA keys for CI/CD7273## Exam Tips74- Basic roles (Owner/Editor/Viewer) → avoid; use predefined for least privilege75- Service account keys = high risk; prefer Workload Identity or metadata server credentials76- IAM is inherited from parent → grant at lowest appropriate level77- **Deny policies** = explicitly deny overrides all allows (use for guaranteed denial)78- Org Policy ≠ IAM; Org Policy = what CAN be done (guardrails); IAM = who CAN do it79- `allUsers` / `allAuthenticatedUsers` = public access; audit carefully
Run npx skillmds@latest add kienbui1995/cloud-iam in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Cloud IAM It is listed under DevOps & Infra on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
kienbui1995 (@kienbui1995) published this skill. Their other Agent Skills are listed on their SkillMD profile.