Scopes, roles, and app roles — from claim to decision
The Mesh Series · Article 18

The Mesh Series · Article 18 · Where Entra meets Istio
Every article so far has stopped at authenticated. The edge proved the caller has a valid token; the service re-proved it; the mesh proved the workload. But "who are you" is only half of access control. The other half — "and are you allowed to do this?" — is authorization, and it turns on two claims in the Entra token that look similar and mean different things. Getting them confused is how you end up with a token that's valid, a caller that's authenticated, and an action that should never have been permitted.
The two claims are scp and roles, and they answer different questions.

A delegated scope (scp) says the application may perform this action on behalf of the signed-in user — and the effective permission is the intersection of what the app was granted and what the user is allowed to do. It always implies a user is present. This is the Ledger.Write scope the On-Behalf-Of call requested in Article 17. An app role (roles) is an assignment: a principal — a user, or an application itself acting with no user — holds this role. A batch job with no user gets its permissions as app roles in the roles claim; a user granted an approver role gets it there too. The mental shortcut: scp is "may act for a user, within limits"; roles is "is assigned this." Reach for the wrong one and either your app-only workload has no permissions (you defined a scope, which needs a user) or your delegated call carries authority the user never had.
Why regulated enterprises should care
Authorization is where segregation of duties lives, and segregation of duties is a named control in every framework a regulated institution answers to. A teller may initiate a transfer but not approve it; a developer may deploy but not release to production; the person who creates a payment cannot be the person who authorizes it. These aren't nice-to-haves — RBI's IT framework, SAMA's CSF, and PCI-DSS all require demonstrable SoD, and "everyone with a valid token can do everything" fails that requirement instantly, no matter how strong your authentication is.
Scopes and roles are how you encode segregation of duties into something enforceable and auditable. Payments.Initiate and Payments.Approve as distinct app roles, never assigned to the same principal, is SoD you can prove by reading the role assignments — not SoD you assert in a policy document nobody enforces. And because the decision rides in a signed token claim, it's the same decision at the mesh, in the code, and in the audit log. When an assessor asks "show me that no single identity can both initiate and approve," the answer is the role-assignment list, not a promise.
The failure this prevents is quiet and common: authentication mistaken for authorization. A service that checks the token is valid and stops there has a door with a working lock and no bouncer deciding who's actually allowed in. Every authenticated caller — including a compromised but legitimately-authenticated one — can do anything the service offers.
How the pieces come together
You define the permissions in Entra, and you enforce them in two places.
In the app registration, you expose delegated scopes (what other apps may request on a user's behalf) and define app roles (assignable to users or to applications). When a token is issued, Entra stamps the granted scopes into scp and the assigned roles into roles.
Then you enforce — twice, because this is defense in depth (Article 13). At the mesh, an AuthorizationPolicy conditions on the claim: when: request.auth.claims[scp] contains Ledger.Write. In the code, Microsoft.Identity.Web checks the same claim: [RequiredScope("Ledger.Write")] for delegated calls, [Authorize(Roles = "Payments.Approver")] for app roles. The mesh rejects the wrong claim cheaply at the boundary; the service re-checks it at the point of action. Same claim, two independent gates — a forgotten mesh rule doesn't grant the action, and a code bug doesn't either.
Show the code
Enforce the delegated scope at the mesh — the ledger's write path requires the Ledger.Write scope in the token:

Enforce the same claim again in C#, at the endpoint — plus an app role for the approval step, which no scope should satisfy:

The distinction is now load-bearing. Writing to the ledger is a delegated action a user's app performs on their behalf — a scope. Approving is an authority a specific principal is assigned — a role, deliberately separate, so the initiator and the approver can never be the same identity. That separation is the segregation-of-duties control, expressed in code and mesh, provable from the role assignments.
Security · Audit · Integration
Security property gained. Least-privilege authorization on top of authentication. A valid token is no longer a skeleton key — it carries exactly the scopes and roles its holder was granted, and every sensitive action checks for the specific permission it requires. Segregation of duties is enforced by construction, not by convention.
Audit evidence produced. The permission model is declarative and inspectable: exposed scopes and defined app roles in the app registration, role assignments in Entra, and enforcement conditions in both the mesh policy and the code. "Prove no identity can both initiate and approve" is answered by the assignment list; "prove the write path requires the write permission" is answered by two policies that both say so.
How it integrates. Scopes are what the OBO exchange requested (Article 17); the claim enforcement is the defense-in-depth pattern (Article 13) applied to authorization; the mesh condition composes with the default-deny baseline (Article 16) and the identity principals (Article 10). Authentication got the caller in the door; this decides what they may touch once inside.
Alternatives, and when you'd actually pick them
Coarse "any authenticated user." The absence of authorization, dressed as simplicity. Fine only for a genuinely public-to-all-staff read endpoint where every authenticated caller genuinely may act. For anything with a sensitive action, it's the authentication-mistaken-for-authorization failure — and it fails every SoD requirement.
Roles in your own datastore. When your authorization is highly dynamic, per-resource, or richer than Entra's role model comfortably expresses — think per-account entitlements, or thousands of fine-grained permissions — you keep an application-level authorization store and use the Entra token only to establish identity. Legitimate and common; the cost is that your authorization is now yours to secure, audit, and keep consistent. Use it when the model genuinely exceeds app roles, not to avoid learning them.
Groups instead of app roles. Entra security groups can drive authorization too, and suit when the same grouping is reused across many apps. The trade is the group-overage problem (tokens cap the number of groups emitted, forcing a Graph call) and looser coupling between the group and the app's intent. App roles are app-specific and travel cleanly in the token; prefer them for per-app permissions, reach for groups when the grouping is genuinely org-wide.
The pain that makes this concrete rarely arrives as an architecture diagram. It arrives as a complaint — someone asks who has access to what, and the honest answer is that nobody can say without going and looking. That question is the whole reason scopes and roles exist as first-class, auditable claims rather than logic buried in code: scp for the user who is present, roles for the app acting on its own, each one an assertion you can query and an auditor can test, instead of an entitlement you reconstruct from memory every time someone asks.
From the toy to the standard
The toy is one scope and one role on one endpoint. The industry-standard version is every sensitive action gated on a specific scope or role, segregation-of-duties encoded as deliberately-separate app roles that are never co-assigned, delegated scopes for user-present calls and app roles for system-present ones used correctly and never confused, and every decision enforced at both the mesh and the code so it survives a bug in either. Authentication proves who; authorization — scopes and roles, from claim to decision — proves allowed to do this specific thing, and proves it to an auditor from the assignments.
We've now built the full identity and authorization stack: workloads and users that prove themselves, tokens validated everywhere, traffic denied by default, the user propagated across hops, and every action gated on a named permission. All of it assumes one thing we've kept deferring — that the secrets and certificates underneath (the ones we haven't already eliminated) are themselves managed properly. Where secrets genuinely must exist, and how certificates live and rotate, is next.
That's Article 19: secrets and certificates, done right.
Next in the series — Article 19: Secrets and certificates.
Key skills & topics in this article
Also on LinkedIn.