Simon Vedder

Cloud Engineer · Zürich

RiskyRolesAnalyzer

Prerequisites

One identity, yours. The script has no write path of its own, so reading and acting are two different sets of rights.

Software

Who needs which role

To run the audit

Read scopes

Your own account, on Graph and Azure in the same tenant.

  • RoleManagement.Read.Directory — Graph, delegated
  • Directory.Read.All — Graph, delegated
  • Group.Read.All — Graph, delegated
  • Application.Read.All — Graph, delegated
  • Reader — each subscription, or a management group above them

To act on a finding

Write, separately

Your own account, and only when you run the command yourself.

  • RoleManagement.ReadWrite.Directory — Graph, delegated
  • Privileged Role Administrator — to remove an Entra assignment
  • User Access Administrator or Owner — the scope of the assignment you remove

-SkipAzure for an Entra-only tenant, -SkipPim where there is no P2.

Before you remove anything

It reports assignments. It does not know why they are there. Read the row, ask the owner, then decide.

Do not use forWhyDo this instead
Continuous monitoringOne run is one point in timeDefender for Cloud, Entra ID Protection, Sentinel
Attack path analysisIt lists and rates; it does not chainBloodHound / AzureHound
Compliance baselinesNo baseline to compare againstMaester, ScubaGear
Unattended cleanupEvery removal is meant to pass a personAccess reviews with auto-apply
Tenants you are not accountable forRead is fine; write needs a mandateReport only

Read "When not to use this" in full

← Overview·Commands