Main Street Identity: Organizing Scopes Across Multiple APIs
Consider a fictional ordering platform named Main Street. The platform consists of three APIs:
- Orders API — manages customer orders.
- Inventory API — manages available inventory.
- Users API — manages users and their accounts.
There are multiple ways we could represent these APIs within Microsoft Entra ID.
Option 1: One App Registration with Multiple Scopes
For a relatively simple application, all three APIs could share a single Main Street App Registration.
Microsoft Entra ID
│
└── Main Street App Registration
│
├── MainStreet.Orders
├── MainStreet.Inventory
└── MainStreet.Users
All access tokens issued for Main Street would have the same audience:
{
"aud": "api://main-street"
}
Scopes would then define which portions of the Main Street API surface the caller has permission to access.
For example, a token issued for access to the Inventory API might contain:
{
"aud": "api://main-street",
"scp": "MainStreet.Inventory",
"roles": [
"MainStreet.Admin"
]
}
The Inventory API could require:
MainStreet.Inventory
while the Orders API requires:
MainStreet.Orders
This means that possessing a valid Main Street token is not sufficient on its own. The API must also validate that the token contains the scope required for the requested operation.
Main Street App Registration
aud: api://main-street
│
┌───────────────────┼───────────────────┐
│ │ │
▼ ▼ ▼
MainStreet.Orders MainStreet.Inventory MainStreet.Users
│ │ │
▼ ▼ ▼
Orders API Inventory API Users API
A caller possessing only:
scp: MainStreet.Inventory
would therefore be authorized to access Inventory endpoints, but would fail the scope check performed by the Orders API.
This remains true even if the token contains:
roles: MainStreet.Admin
The role identifies privileges associated with the identity, while the scope identifies the API capabilities granted to the token.
This approach works well when Orders, Inventory, and Users are primarily modules of a single application and share a common security boundary.
Option 2: Separate App Registration for Each API
As Main Street grows, the APIs may become independently deployed services with different security requirements, clients, or ownership.
Instead of representing the entire backend with one App Registration, each API can be registered as its own protected resource.
Microsoft Entra ID
│
├── Main Street Orders
│ ├── Orders.Read
│ └── Orders.Write
│
├── Main Street Inventory
│ ├── Inventory.Read
│ └── Inventory.Write
│
└── Main Street Users
├── Users.Read
└── Users.Write
Each API now has its own audience.
Orders API
aud: api://mainstreet-orders
Inventory API
aud: api://mainstreet-inventory
Users API
aud: api://mainstreet-users
An access token intended for Inventory could look like:
{
"aud": "api://mainstreet-inventory",
"scp": "Inventory.Read Inventory.Write",
"roles": [
"MainStreet.Admin"
]
}
The architecture now looks more like:
Main Street Client
│
┌──────────────────┼──────────────────┐
│ │ │
▼ ▼ ▼
Orders Registration Inventory Registration Users Registration
│ │ │
aud: orders aud: inventory aud: users
│ │ │
▼ ▼ ▼
Orders API Inventory API Users API
If the caller sends the Inventory token to the Orders API, the token can be rejected before considering its scopes or roles:
Token audience:
api://mainstreet-inventory
Orders expected audience:
api://mainstreet-orders
Result:
Rejected
The caller’s MainStreet.Admin role does not change the fact that the access token was issued for another resource.
This creates an additional security boundary between services.
Comparing the Two Designs
The major difference is where the resource boundary exists.
With one App Registration:
Audience → Main Street
Scope → Which Main Street capabilities?
Role → What privileges does this identity have?
With separate App Registrations:
Audience → Which Main Street API?
Scope → What can the caller do within that API?
Role → What privileges does this identity have?
Neither design is inherently incorrect.
A single App Registration can be appropriate when several APIs are really components of the same application and share a common security model. Separate App Registrations become attractive when those APIs are independently deployed services that require stronger isolation, different permissions, or independent lifecycle management.
The important distinction is that audiences, scopes, and roles answer different authorization questions:
Audience: Is this token intended for me?
Scope: What API capabilities was this caller granted?
Role: What privileges does this identity have?
Those concepts can then be combined to build the authorization model appropriate for the application.