Skip to main content
emnode
Compliance

Apply least-privilege RBAC on Azure subscriptions

One capability across every subscription: make sure the people with the most power, the Owners and other privileged role holders, are the smallest possible set of named, current, internal accounts, and that nobody and nothing keeps standing access it no longer needs.

14 min·10 sections·AZURE

Last reviewed

Least-privilege RBAC: the basics

What does over-privileged access on an Azure subscription actually look like?

An Azure subscription is governed by who holds its roles, and the most dangerous of those is Owner: full control over every resource plus the ability to grant that control to anyone else. Over-privileged access shows up in a handful of distinct shapes rather than one setting. There can be too many Owners, so the set of people who can do anything has quietly grown past the point anyone can vouch for. There can be external accounts holding Owner, guest or partner identities from another tenant whose sign-ins and lifecycle you do not control. And there can be deprecated accounts, identities that have been blocked from signing in by Microsoft Entra ID but still carry a live role assignment. Each is its own Defender for Cloud recommendation, but the underlying risk is the same: more identities can take privileged action on the subscription, or could be reactivated to, than you actually intend.

Microsoft Defender for Cloud turns each of these into its own recommendation under the Privileged Access pillar of the Microsoft Cloud Security Benchmark, which is why one busy subscription can fail several access checks at once. 'A maximum of 3 owners should be designated for subscriptions', 'External accounts with owner permissions should be removed from subscriptions' and 'Deprecated accounts should be removed from subscriptions' read as separate problems on the report, but they are one job: shrink the privileged set to the smallest number of named, current, internal accounts, and remove anything stale that still carries access.

Most of this exposure is drift, not intent. An Owner granted for a one-off migration and never revoked. A partner given subscription-level access for an integration that finished a year ago. An employee who left, whose Entra account is now blocked but whose role assignment on the subscription was never cleaned up. The work is to find every privileged assignment that is broader, more external or more stale than intended, decide which handful genuinely need to stay, and remove or downgrade the rest, ideally replacing standing Owner with just-in-time access so nobody holds the keys when they are not using them.

In this lesson you will learn how Azure expresses privileged access through RBAC role assignments, how to find every Owner, external account and deprecated account across a subscription, and how to shrink that set to the smallest current, internal group without locking yourself out. The Controls this lesson covers section lists every Defender for Cloud recommendation in this capability, each linking to a deep page with the exact check and a copy-and-paste fix.

Fun fact

The Owner nobody remembered

Some of the most damaging cloud incidents on record did not start with a clever exploit; they started with a privileged account that should not have still existed. A leaver whose access was never revoked, a contractor account reused months after the engagement, a partner identity from another tenant that kept full control long after the project shipped. Microsoft Entra ID can block a departed user from signing in within minutes, but blocking the sign-in does not remove the role assignment on the subscription, so the account sits there, deprecated but still privileged, waiting for someone to re-enable it or for an attacker to find the path back in. That gap between 'blocked' and 'removed' is exactly what the deprecated-accounts recommendation exists to close.

Finding over-privileged access across a subscription

Sam is the security lead at a scale-up preparing for its first ISO 27001 audit. Defender for Cloud shows identity and access findings on two production subscriptions that pre-date the team's current guardrails: too many Owners, a couple of external accounts and at least one blocked account that still has a role.

Rather than work the findings one by one, Sam starts by listing exactly who holds Owner on each subscription, flagging which assignments are external tenants and which point at accounts that no longer sign in, so the genuinely needed Owners can be separated from drift before anything changes.

Start by listing everyone who holds Owner on the subscription. The principalType and sign-in domain tell you which are external, and the count tells you whether you are over the cap of three.

$ az role assignment list --scope "/subscriptions/$SUB" --role Owner --query "[].{who:principalName, type:principalType}" -o table
Who Type
------------------------------- -----
# 4+ Owners, one external partner, one blocked leaver. All three findings, one subscription.

An external partner holding Owner and a blocked leaver still carrying the role are the highest-value targets in this group. Remove these first, then bring the total Owner count back under three.

How Defender for Cloud decides privileged access is too broaddeep dive

All three recommendations resolve to the set of RBAC role assignments at subscription scope, read against Microsoft Entra ID. The owner-count check simply counts the distinct principals assigned the built-in Owner role, whose definition ID is 8e3af657-a8ff-443c-a75c-2fe8c4bcb635, and flags the subscription when that count exceeds three. The external-accounts check compares the domain of each Owner principal against the subscription's home tenant: a guest or principal from a different tenant is treated as external because its sign-in policy and lifecycle sit outside your control. The deprecated-accounts check cross-references each assigned principal against Entra ID and flags any whose account has been blocked from signing in, because a blocked account that still holds a role is dormant privilege waiting to be reactivated.

Defender for Cloud evaluates these against the Microsoft Cloud Security Benchmark on a periodic cycle, so a fix does not flip the recommendation to Healthy instantly. Removing a role assignment is immediate at the control plane, but the posture catches up on the next assessment. This matters when you are gathering audit evidence against a deadline, and it is why you request the evidence with a little lead time rather than the morning of.

The strongest position combines a clean list today with structural controls that keep it clean: consolidate Owners behind a single Entra group so the membership is governed in one place, make those assignments eligible rather than active through Privileged Identity Management so nobody holds standing Owner, and schedule recurring access reviews so external and dormant accounts are caught and removed automatically. Turning those on is the difference between proving the set is small today and guaranteeing it cannot quietly grow again tomorrow.

What is the impact of leaving privileged access too broad?

The direct impact is total subscription compromise from a single account. An Owner can read every secret in every Key Vault, delete or encrypt every resource, exfiltrate every data store and grant new access to anyone, including making the damage persistent. Each surplus Owner, external Owner or deprecated account is one more identity that, if phished, leaked or misused, hands an attacker the whole subscription. The overwhelming majority of these assignments are accidents of drift: access granted for a real reason that outlived the reason.

The second-order impact is blast radius and accountability. Every privileged account is something that must be trusted, monitored and defended continuously, and an external or dormant one cannot be. You cannot enforce conditional access or multi-factor on a partner tenant you do not own, and a blocked account that still carries a role is an open invitation: re-enable it, or compromise the original credential, and the privilege is live again. Shrinking the privileged set to a small group of current, internal accounts shrinks the surface to identities you actually control and can audit.

On the compliance side, every modern framework, ISO 27001, SOC 2, HIPAA, PCI DSS and the UK and EU data-protection regimes, expects least-privilege access control and prompt removal of access for leavers and third parties. A subscription with a tight, named, current set of Owners and no external or deprecated assignments is one of the cheapest and most defensible artefacts you can hand an auditor, and it maps directly to the access-control clauses they test.

How do you tighten privileged access safely?

Work the capability as one loop rather than chasing individual findings. The order matters: make sure you keep at least one Owner you control before you start removing anything, so you do not lock the team out of the subscription.

1. Inventory every privileged assignment

List every principal that holds Owner at subscription scope, and flag which are groups, which are external tenants, and which point at accounts blocked in Microsoft Entra ID. Treat this inventory as the source of truth, not the Defender finding count, because one subscription can trigger all three recommendations at once. Confirm at least one legitimate, internal Owner you control before touching anything else.

2. Remove the external and deprecated accounts first

External partner accounts whose work has finished, and blocked leaver accounts that still carry a role, are pure liability and should go first. Blocking a sign-in in Entra does not remove the role assignment, so delete the assignment explicitly. For external partners who still need access, scope them to the least role that does the job and time-box it, never leaving them as standing Owner.

3. Bring the Owner count under three by consolidating, not just deleting

Aim for two or three Owners per subscription: enough to avoid a lockout, few enough to be defensible. Assign Owner to a single Microsoft Entra group rather than to many individuals, and downgrade anyone who does not need to manage permissions to Contributor. Managing membership in one place keeps the count honest and gives you a single record of who can do what.

4. Make it just-in-time and ratchet it shut

Convert the remaining Owner assignments from active to eligible through Microsoft Entra Privileged Identity Management, so privilege is activated on demand with approval and time limits rather than held permanently. Schedule recurring access reviews so external and dormant accounts are caught and removed automatically, and the privileged set is re-justified every quarter rather than only when an audit forces it.

# Find the highest-risk privileged assignments first: external accounts and blocked leavers holding Owner.
SUB="00000000-0000-0000-0000-000000000000"

# List Owners, with type and object id, so external and group principals are obvious.
az role assignment list \
  --scope "/subscriptions/$SUB" \
  --role Owner \
  --query "[].{who:principalName, type:principalType, id:principalId}" -o table

# Remove an external partner's Owner assignment (work finished). Keep at least one Owner you control.
az role assignment delete \
  --assignee "[email protected]" \
  --role Owner \
  --scope "/subscriptions/$SUB"

# Remove a deprecated (blocked) account's role assignment by object id.
# Blocking the Entra sign-in does NOT remove the assignment; delete it explicitly.
az role assignment delete \
  --assignee-object-id "<blocked-user-object-id>" \
  --scope "/subscriptions/$SUB"

# Consolidate the remaining legitimate Owners behind one Entra group, then make it eligible
# (just-in-time) via Privileged Identity Management so nobody holds standing Owner.

Quick quiz

Question 1 of 5

Defender for Cloud shows three findings on one subscription: too many Owners, an external account with Owner, and a deprecated account. What is the most efficient way to think about them?

You can now treat privileged access as one capability rather than a scatter of findings: inventory who holds Owner on each subscription, remove the external and deprecated accounts first, bring the count under three by consolidating the genuine admins behind a single group, and ratchet the estate shut with just-in-time activation and recurring access reviews. The Controls this lesson covers section below links every recommendation in this group to its deep page and fix.

Back to the library

Controls this lesson covers

One capability, many Microsoft Defender for Cloud recommendations. This lesson is the shared playbook; each control below keeps its own deep page with the exact check, severity and a copy-and-paste fix.