Everyone agrees with least privilege, yet most environments still run on broad roles, wildcard policies, permanent admin rights and service accounts that can do far more than their job. The gap is not the principle but the technique: how to find the permissions a person, workload or agent actually needs, grant only those, keep them right as things change, and prove it. This guide collects the practical methods: building roles from observed activity, cloud policy generation and unused access reports, guardrails such as permission boundaries and organisation policies, scoping and conditions, separation of setup from operation, endpoint and directory techniques, and measurement. It is written for IAM, PAM, cloud and platform engineers. Time-bound elevation is covered in depth in the JIT Access Guide; this page covers the wider toolkit around it.
Key takeaways
- Record-then-replace beats guesswork: observe what an identity really does (cloud audit logs, last accessed data), generate a narrow policy from that, test it, then remove the broad one.
- Separate setup from operation: the permissions needed to deploy or configure something are rarely needed to run it; split them into different roles or pipelines.
- Use guardrails as well as grants: permission boundaries, organisation policies and deny rules cap what any grant can do, so one mistake does not become a breach.
- Scope beats roles: the same role at a smaller scope (one resource group, one namespace, one administrative unit) is often the biggest single reduction.
- Least privilege decays: without unused permission reports, reviews and leaver processes, privilege creep returns within months; measure it continuously.
What least privilege means in practice
NIST SP 800-53 Rev. 5 control AC-6 requires allowing only the accesses necessary to accomplish assigned tasks, and its enhancements turn that into concrete requirements, from dedicated privileged accounts to logging privileged functions. NIST CSF 2.0 outcome PR.AA-05 asks that permissions are defined in policy, managed, enforced and reviewed with least privilege and separation of duties. The practical dimensions are:
| Dimension | Question | Typical technique |
|---|---|---|
| Actions | Which operations are needed? | Fine-grained permissions instead of built-in "Owner", "Editor" or wildcard actions |
| Resources | On which objects? | Resource ARNs, scopes, namespaces, administrative units, tags |
| Conditions | Under what circumstances? | Source network, TLS required, calling service, device compliance, time |
| Time | For how long? | Just-in-time elevation, expiry on assignments, short-lived credentials |
| Identity | Which account holds it? | Separate admin accounts, per-workload identities, no shared accounts |
| Combination | Does this plus existing access create a toxic mix? | Separation of duties rules (AC-5) at request time |
Techniques for finding the right permissions
The IDPro Body of Knowledge article "Techniques To Approach Least Privilege" describes two basic ways to build a role, and most tooling automates one of them.
- Fail-then-add: start with no permissions, run the process, add each permission it fails on, repeat. It produces tight roles for simple tasks but is slow, and loosely added permissions that are never removed cause privilege creep.
- Record-then-replace (preferred): run the process with a privileged role in a safe environment, record the actions it takes from audit logs, build a role from those actions, and use it instead. Review the result for unrelated actions captured during recording.
- Cloud policy generation: AWS IAM Access Analyzer generates fine-grained policies from CloudTrail activity, and AWS advises testing each generated policy before production. Google Cloud's IAM recommender compares granted with used permissions over up to 90 days and suggests removing a role or replacing it with a less permissive one; it never applies changes itself.
- Unused access reports: AWS last accessed information, Google Cloud policy insights (
PERMISSIONS_USAGE) and similar Entra and Azure reports show what has not been used. Removal of unused roles, users and credentials is a standing AWS best practice. - Least privileged role tables: Microsoft publishes the least privileged built-in Entra role for common tasks, for example License Administrator to assign licences, Groups Administrator to create groups and Reports Reader to read audit and sign-in logs, rather than Global Administrator.
Limits of usage-based methods
- Rare tasks are missed: quarterly jobs, disaster recovery and year-end processes may not appear in a 90-day window. Google Cloud's recommender uses machine learning to predict likely needs, but you still need owner confirmation before removal.
- Coverage gaps: Google's recommender does not analyse ACLs or Kubernetes RBAC and gives no insights for roles granted with conditions; check each tool's documented limits.
- Recording captures noise: setup steps and exploratory clicks end up in recorded policies unless you separate them.
Guardrails that cap what grants can do
Guardrails do not grant access; they limit it. AWS documentation states that service control policies (SCPs) and resource control policies (RCPs) grant no permissions, and that a permissions boundary sets the maximum an identity-based policy can grant without granting anything itself.
| Guardrail | Platform examples | Use it to |
|---|---|---|
| Organisation-wide deny | AWS SCPs and RCPs, Google Cloud organisation policies and deny policies, Azure Policy | Block regions, disable risky services, prevent turning off logging, stop public sharing |
| Permissions boundary | AWS permissions boundaries | Let teams create their own roles without being able to exceed a ceiling |
| Scoped administration | Entra administrative units, Azure RBAC scopes, Kubernetes namespaced Roles | Delegate admin rights for one business unit, subscription or namespace |
| Conditions | IAM policy conditions, Conditional Access, attribute-based role conditions | Require TLS, a specific calling service, a compliant device or a network location |
| Policy validation | AWS IAM Access Analyzer policy checks (more than 100), policy-as-code tests in CI | Catch wildcards, public access and risky combinations before deployment |
| External access analysis | Access Analyzer findings for public and cross-account access | Detect resources shared outside the organisation |
See the Policy-as-Code for Authorisation Guide and the Cloud PAM and CIEM Guide.
Design techniques that make least privilege sustainable
- Separate setup from operations: deployment pipelines need to create resources and change policies; the running application needs to read and write its own data. Use different identities, and stop recording before operational use so setup permissions are not carried into the runtime role (an IDPro recommendation).
- Dedicated privileged accounts: AC-6(5) restricts privileged accounts to defined personnel, and AC-6(2) requires non-privileged accounts for non-security work. Administrators read email and browse with a standard account and use a separate admin account. See the Tiered Administration and Enterprise Access Model Guide.
- Prefer scope reduction before role redesign: moving an assignment from subscription to resource group, or from tenant to administrative unit, often cuts reach by an order of magnitude with no new roles.
- Avoid wildcards: wildcard actions automatically include new permissions a provider adds later, a drift risk IDPro calls out. Prefer explicit action lists and monitor provider permission changes.
- Design roles from tasks, not people: build roles around job functions and birthright access, then handle exceptions through requests with expiry. See the Role Mining and Role Design Guide.
- Deny by default for new resources: templates and landing zones should create resources with no access beyond the owning workload, and require explicit grants.
- Make elevation temporary: combine narrow standing roles with just-in-time elevation for the rest. IDPro recommends an extra authentication factor when checking out permissions.
Least privilege by environment
| Environment | Highest-value techniques | Related guide |
|---|---|---|
| Endpoints | Remove local admin rights, use endpoint privilege management for approved elevations, unique local admin passwords with LAPS | Endpoint Privilege Management Guide |
| Active Directory | Empty standing membership of Domain Admins, delegate via groups on OUs, review ACLs, protect tier 0 | AdminSDHolder, SDProp and Protected Groups Guide |
| Entra ID and Microsoft 365 | Least privileged role per task, administrative units, PIM eligible assignments, application permission review | Privileged Identity Management (PIM) Guide |
| AWS, Azure, Google Cloud | Policy generation, unused access removal, organisation guardrails, permissions boundaries, scoped roles | Cloud PAM and CIEM Guide |
| Kubernetes | Namespaced Roles, no cluster-admin bindings for workloads, no wildcard verbs, care with secrets, bind, escalate and impersonate | Kubernetes RBAC Guide |
| Linux and Unix | Command-scoped sudo rules, no shared root, session recording for privileged shells | Unix and Linux Privileged Access Guide |
| SaaS and APIs | Narrow OAuth scopes, per-integration tokens, admin roles per application | OAuth Scope Design Guide |
Where identity fits: non-human identities and AI agents
Service accounts, API tokens and agent credentials are where over-privilege is most common and least visible, because nobody reviews them like a person's access. In the PocketOS database deletion, a token created only to manage custom domains carried account-wide authority; an AI coding agent found it and deleted the production database and backups in one API call. Techniques that work for machines:
- One identity per workload: never share a service account across applications; per-workload identities make usage-based right-sizing possible.
- Scope tokens at creation: choose the narrowest token type and scope the platform offers (project or resource level, read-only where possible) and set an expiry.
- Short-lived credentials: workload identity federation and managed identities remove long-lived keys entirely.
- Agents get their own identity and limits: an agent should not inherit a developer's full access; give it a separate, narrow identity and require approval for destructive actions. See the OWASP NHI Top 10 NHI5 Overprivileged NHI Guide.
Choosing techniques: decision guidance
- Start where blast radius is largest: tier 0 and cloud organisation admins, identities with wildcard or owner rights, and machine identities with production write access.
- Usage-based removal versus redesign: use unused access removal for quick wins on existing estates; redesign roles where the same broad role is copied across many teams.
- Standing narrow role versus JIT: keep a narrow standing role for daily tasks and use JIT for rare, high-impact actions. If an elevation is requested several times a day, the standing role is probably too narrow.
- Small organisations: focus on separate admin accounts, removing local admin, cloud built-in recommendations and organisation guardrails; these need little tooling.
- Large organisations: add an IGA or CIEM layer to aggregate entitlements, run campaigns, enforce separation of duties and report drift across platforms. See the Access Reviews Guide.
Keeping it right after the first clean-up
- Review privileges, not just accounts: AC-6(7) asks organisations to review user privileges at a defined frequency and reassign or remove those no longer needed. Give reviewers usage data next to each entitlement so they are not approving blind.
- Check separation of duties at request time: block or flag requests that combine, for example, the ability to create vendors and approve payments, or to deploy code and approve its change ticket. Detecting the conflict at review time months later is too late.
- Expire exceptions: every access granted outside a role should carry an end date and an owner, so exceptions do not quietly become the norm.
- Re-baseline after major change: migrations, reorganisations and new platforms reset usage patterns; rerun policy generation and reviews after them rather than waiting for the next cycle.
Implementation roadmap
- Inventory privileged and broad access: list every assignment of owner, admin, wildcard and cross-account rights for people and machines, with owners.
- Apply guardrails first: organisation-wide denies for the worst actions (disabling logs, public sharing, deleting backups) protect you while you right-size.
- Right-size in audit mode: generate candidate policies from activity, compare them with current grants, and review with owners. Run the narrow policy in a test environment or alongside the old one where the platform supports simulation.
- Pilot with one team: replace broad roles with generated ones, keep the old role available as a break-glass elevation for a few weeks, and track access denied events.
- Roll out by risk tier: production and tier 0 first, then the long tail. Roll back an individual change by re-granting the previous role through JIT for a limited time, not permanently.
- Remove unused access on a schedule: automate removal suggestions monthly; require owner confirmation for anything unused for 90 days.
- Embed in delivery: policy validation in CI, templates with deny-by-default, and access requests with expiry so new access starts least privileged.
Detection and measurement
Log privileged function use (AC-6(9)), role assignment changes, policy changes and access denied events. Alert on new owner or admin assignments outside the request process, wildcard policies created, and privilege escalation patterns mapped in MITRE ATT&CK such as T1098 Account Manipulation and T1078.004 Cloud Accounts.
- Standing privileged assignments: number of permanent admin and owner assignments, trending down.
- Unused permission ratio: share of granted permissions not used in 90 days, by platform and identity type.
- Wildcard policy count: policies with wildcard actions or resources, target near zero outside break-glass.
- Machine identities with production write or admin rights: count and owners.
- Access denied rate after right-sizing: should spike briefly then settle; a persistent high rate means roles are too narrow and users will seek workarounds.
- Review completion and revocation rate: percentage of reviews completed on time and entitlements removed.
Framework mapping
| Framework | Reference | Technique |
|---|---|---|
| NIST SP 800-53 Rev. 5 | AC-6, AC-6(1), AC-6(2), AC-6(5), AC-6(7), AC-6(9), AC-6(10) | Necessary access only, dedicated privileged accounts, review of privileges, logging privileged use |
| NIST SP 800-53 Rev. 5 | AC-5, AC-2(3), CM-7 | Separation of duties, disabling unused accounts, least functionality |
| NIST CSF 2.0 | PR.AA-05 | Permissions defined, managed, enforced and reviewed with least privilege |
| CIS Controls v8.1 | Control 5 Account Management, Control 6 Access Control Management | Dedicated admin accounts, role-based access, revocation |
| ISO/IEC 27001:2022 Annex A | A.5.15 Access control, A.5.18 Access rights, A.8.2 Privileged access rights | Policy, provisioning and review of rights |
| MITRE D3FEND | D3-UAP User Account Permissions | Restricting account permissions as a defensive technique |
Common failure patterns
- Admin by default for convenience: developers and agents given owner rights "for now", which become permanent. The PocketOS incident above is the machine identity version.
- Recording everything into the runtime role: setup and policy-change permissions captured during recording end up in the production role.
- Managed policies left as the end state: AWS notes managed policies may not be least privilege for your use case; treat them as a start.
- Removing access without owners: bulk removals based only on 90-day usage break rare but critical jobs, and the backlash leads to broad re-grants.
- Wildcards and inherited scope: broad assignments at tenant, organisation or subscription level silently cover every new resource.
- Movers keep old access: new role access is added but old access stays, creating toxic combinations. See the Joiner-Mover-Leaver Guide.
Practitioner checklist
- Inventory owner, admin, wildcard and cross-account grants for people, workloads and agents, with named owners.
- Deploy organisation-level deny guardrails for log tampering, public sharing and backup deletion.
- Use activity-based policy generation and unused access reports to propose narrower roles, and test before enforcing.
- Split setup and deployment permissions from runtime permissions into different identities.
- Give administrators separate privileged accounts and remove standing membership of top-tier groups.
- Reduce scope (resource group, namespace, administrative unit) before creating new roles.
- Issue one identity per workload with scoped, expiring or federated credentials.
- Validate policies in CI and block wildcards outside break-glass.
- Track standing privilege, unused permission ratio and wildcard count monthly.
Standards and references
- NIST: SP 800-53 Rev. 5
- NIST: Cybersecurity Framework 2.0
- IDPro Body of Knowledge: Techniques To Approach Least Privilege
- AWS: Security best practices in IAM
- Google Cloud: Role recommendations overview
- Microsoft Learn: Least privileged roles by task in Microsoft Entra ID
- MITRE D3FEND: User Account Permissions
Related NHI Mgmt Group resources: JIT Access Guide · Privileged Access Management Guide · Cloud PAM and CIEM Guide · OWASP NHI Top 10 NHI5 Overprivileged NHI Guide