# Identity, Access and Least Privilege

> Design who and what can access your systems: SSO for humans, workload identity for machines, scoped roles and auditable break-glass access. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/iam-least-privilege
Last updated: 2026-11-28

Design who and what can access your systems: SSO for humans, workload identity for machines, scoped roles and auditable break-glass access.

Intermediate · about 5 hours · difficulty 3/5

Learn first: [AWS Core Services](https://www.internhack.in/roadmaps/tracks/devops/aws-core), [Configuration, Secrets, Storage and RBAC](https://www.internhack.in/roadmaps/tracks/devops/k8s-config-storage)

Most serious cloud incidents come down to identity: a leaked key with admin rights, a role anyone could assume, a forgotten user. Getting IAM right is one of the highest-value things a DevOps engineer does.

### Principles

- **Least privilege**: grant only the actions and resources needed, then tighten further with conditions.
- **No long-lived credentials**: humans use **SSO** with MFA and get temporary sessions; workloads use **roles** and **workload identity** (IRSA or EKS Pod Identity, Azure workload identity, GKE Workload Identity); CI uses **OIDC federation**.
- **Separate environments** into different accounts, subscriptions or projects so a dev mistake cannot touch prod.
- **Audit everything**: CloudTrail, Azure Activity Log, Cloud Audit Logs, and Kubernetes audit logs.

### Reading and writing policies

Understand the pieces of a policy: **principal**, **action**, **resource**, **condition**, and **effect** (allow or deny). Know how explicit denies, permission boundaries and organisation-level guardrails (Service Control Policies, Azure Policy, Organization Policy) combine. Use access analysers and last-used data to remove unused permissions.

### Kubernetes RBAC

Roles and ClusterRoles, bound to users, groups and service accounts. Avoid `cluster-admin` for apps, disable automounting service account tokens where not needed, and map cloud IAM groups to cluster roles.

### Break-glass and reviews

Keep an emergency admin path that is locked away, alarmed and reviewed after use. Run periodic **access reviews** and remove leavers promptly; just-in-time elevation tools grant admin for an hour instead of forever.

**Good enough to move on:** you can write a scoped policy for an app that reads one bucket and one secret, give a Kubernetes pod cloud access with workload identity, and find unused permissions with an access analyser.

## Key concepts

- **Least privilege and conditions**
- **SSO and MFA for humans**
- **Roles and workload identity**
- **OIDC federation for CI**
- **Policy evaluation and guardrails**
- **Kubernetes RBAC and service accounts**
- **Audit logs**
- **Break-glass and access reviews**

## Mini project

Remove every static access key from one of your projects: SSO for your own access, OIDC for CI, and workload identity for the app's pods, each with a least-privilege policy, and verify with the audit log.

## Check yourself

A policy allows s3:\* on all resources, and an organisation guardrail denies s3:DeleteBucket. Can the role delete a bucket? Why?

## Free resources

- [AWS IAM user guide](https://docs.aws.amazon.com/IAM/latest/UserGuide/) (AWS)
- [Kubernetes RBAC authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) (kubernetes.io)
- [Security hardening with OpenID Connect](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect) (GitHub)

Previous: [Software Supply Chain Security](https://www.internhack.in/roadmaps/tracks/devops/supply-chain-security) · Next: [Policy as Code and Compliance](https://www.internhack.in/roadmaps/tracks/devops/policy-as-code)

## More in DevSecOps and Supply Chain Security

- [Shift-Left Security: SAST, SCA and DAST](https://www.internhack.in/roadmaps/tracks/devops/security-scanning)
- [Software Supply Chain Security](https://www.internhack.in/roadmaps/tracks/devops/supply-chain-security)
- [Identity, Access and Least Privilege](https://www.internhack.in/roadmaps/tracks/devops/iam-least-privilege)
- [Policy as Code and Compliance](https://www.internhack.in/roadmaps/tracks/devops/policy-as-code)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
