Securing Data API Builder Endpoints
This lesson explains DAB authentication providers, roles, field restrictions, database policies and the hardening settings for REST, GraphQL and MCP.
Learning outcomes
After completing this lesson, you will be able to:
- Choose an authentication provider for a DAB deployment.
- Explain roles, field restrictions and database policies.
- Identify settings that harden REST, GraphQL and MCP endpoints.
Authentication providers
runtime.host.authentication.provider decides how DAB identifies callers, as the following table explains.
| Provider | Behaviour | Use |
|---|---|---|
| Unauthenticated (default) | No tokens are inspected; every request is anonymous | Behind a trusted front end that handles authentication |
| EntraId | Validates Microsoft Entra JWT bearer tokens against jwt.audience and jwt.issuer | Production APIs for Microsoft identities |
| Custom | Validates JWTs from another identity provider | Okta, Auth0 or other providers |
| AppService | Trusts App Service authentication (EasyAuth) headers | DAB hosted behind App Service authentication |
| Simulator | Simulates authenticated users | Local development only; requires development mode |
DAB authentication providers
Roles and permissions
Each entity's permissions list roles and allowed actions (create, read, update, delete and execute for stored procedures). The system roles are anonymous and authenticated; custom roles come from the token's roles claim, and a client selects one with the X-MS-API-ROLE header. In DAB 2.0, a role without its own entry inherits from authenticated, which inherits from anonymous. Field-level control uses fields.include and fields.exclude, and a database policy adds an OData-style predicate for read, update and delete, using @item for fields and @claims for token claims.
"Order": {
"source": { "object": "Sales.Orders", "type": "table" },
"permissions": [
{
"role": "customer",
"actions": [
{ "action": "read",
"fields": { "include": ["*"], "exclude": ["InternalNotes"] },
"policy": { "database": "@item.CustomerOid eq @claims.oid" } }
]
},
{ "role": "support", "actions": ["read", "update"] }
]
}DAB roles and policies
Hardening each surface
The same permissions apply to REST, GraphQL and MCP, and each surface has extra settings, summarized in the following list.
- REST: keep
request-body-stricttrue, disable REST for entities that do not need it, and restrict CORS origins. - GraphQL: in production, consider setting
allow-introspectionto false and adepth-limitto stop expensive nested queries. - MCP: disable tools the agents do not need, such as
runtime.mcp.dml-tools.delete-record, setmcp.dml-tools: falseon entities agents must not see, and add descriptions so agents use entities correctly. - Host: run in production mode behind HTTPS, connect to the database with a managed identity mapped to a least-privilege database user, and send telemetry to Application Insights.
For Row-Level Security in the database, the data source option set-session-context passes the caller's claims to SESSION_CONTEXT, so database predicates enforce the same rules even outside DAB.
Which surface does it harden?
Customers see only their orders
A mobile app calls a DAB endpoint with Microsoft Entra tokens. Customers must read only their own orders, never see the InternalNotes column, and an AI agent using the MCP endpoint must not be able to delete any data. What configuration is needed?
Set the provider to EntraId with the API's audience and issuer; give the customer role read access on the Order entity with fields.exclude for InternalNotes and a database policy @item.CustomerOid eq @claims.oid; and disable the delete-record MCP tool in the runtime settings. With the default Unauthenticated provider every caller would be anonymous, and filtering in the mobile app would not stop a caller from requesting other customers' rows.
With the default Unauthenticated provider, which role do requests run as?
Show answer
anonymous; authenticated and custom roles are never activated, so they need another provider.
Exam Tips
Remember for the exam
- Validate Microsoft Entra tokens in DAB: provider EntraId with jwt audience and issuer.
- Per-user rows: database policy with @item and @claims.
- Hide columns per role: fields.exclude.
- Stop agents deleting: disable delete-record in runtime.mcp.dml-tools.