Effective identity and tokens
Issue only a narrowly scoped token
For app owns data, authenticate the application user on your server, resolve the allowed workspace/report/model and effective identity from trusted records, acquire a server-side Entra access token, call the documented GenerateToken API, and send only the scoped embed token, report ID, embed URL and expiry to the client. The application’s Entra token and service principal credentials never belong in browser code. Treat even the embed token as a bearer secret.
Effective identity and scope
Generate Token V2 accepts report and semantic model resources and effective identities when needed. With RLS, pass the applicable username, roles and model IDs according to the model and source type. Static roles select a defined filter; dynamic roles evaluate the effective identity. Use server-owned entitlements, not browser-supplied roles or customer IDs. For cloud RLS with a service principal, provide required effective identity. Verify model lineage and source-specific SSO/OLS limitations independently. Workspace separation and RLS address different isolation layers; neither an application tenant nor a service principal profile automatically means a Microsoft Entra tenant.
Worked example 1 — scoped request
Illustrative request body only, with invalid real-world IDs; do not send it. The server has already authorized Alice and validated the report-to-model link. The RegionalViewer role is assumed to exist and map the effective username to North.
{ "reports": [ { "id": "sales-a", "allowEdit": false } ], "datasets": [ { "id": "model-a" } ], "identities": [ { "username": "alice", "roles": [ "RegionalViewer" ], "datasets": [ "model-a" ] } ]}For the fixture, expected rows are A1 and A2, worth $150. Alan sees A3 ($80), and Bea sees B1 ($900). A missing mapping denies issuance in our local policy. The real API needs valid resource identifiers, permission and supported model configuration.
Worked example 2 — expiration and renewed authorization
In the local mock, api.issue("alice", "sales-a", 0) returns an opaque fake handle with expiry 60. At second 50 the client requests renewal; the backend rechecks Alice’s entitlement and returns a fresh handle expiring at 110. At second 60 the original handle is expired. If Alice is revoked before the next renewal, the request is denied and the client clears its report session. Existing tokens are not assumed instantly revoked; scope their lifetime and implement session and incident controls.
Prevent authority injection
Never accept effective identity, roles, arbitrary embed URLs or dataset IDs as authoritative client input. Check the signed-in session, authorize each issuance including renewal, restrict editing/export separately, use TLS and avoid recording credentials or token strings in logs. Dedicated service principals or profiles need explicit least-privilege access and customer lifecycle management. In a real deployment, tokens and cache entries must never be reused across unrelated customer/user scopes.
Practice and references
Using fixture.json, trace the three authorized identities and the unmapped case. Predict the output of an Alice request for sales-b and a client-supplied Admin role. See Generate Token, effective identity, token scope and multitenancy profiles.