Lesson 2 of 2 Securing Model and API Endpoints

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.

ProviderBehaviourUse
Unauthenticated (default)No tokens are inspected; every request is anonymousBehind a trusted front end that handles authentication
EntraIdValidates Microsoft Entra JWT bearer tokens against jwt.audience and jwt.issuerProduction APIs for Microsoft identities
CustomValidates JWTs from another identity providerOkta, Auth0 or other providers
AppServiceTrusts App Service authentication (EasyAuth) headersDAB hosted behind App Service authentication
SimulatorSimulates authenticated usersLocal development only; requires development mode
Match the pairs

DAB authentication providers

Exam skills 2.1.8

Match each hosting situation with the DAB authentication provider that fits it.

Log in to try this activity Interactive activities are free with an account.

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"] }
  ]
}
True or false

DAB roles and policies

Exam skills 2.1.8 · 2.4.2

Decide whether each statement about DAB permissions is true.

Log in to try this activity Interactive activities are free with an account.

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-strict true, disable REST for entities that do not need it, and restrict CORS origins.
  • GraphQL: in production, consider setting allow-introspection to false and a depth-limit to stop expensive nested queries.
  • MCP: disable tools the agents do not need, such as runtime.mcp.dml-tools.delete-record, set mcp.dml-tools: false on 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.

Sort into groups

Which surface does it harden?

Exam skills 2.1.8

Decide which DAB surface each hardening setting applies to.

Log in to try this activity Interactive activities are free with an account.
Worked example

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.

Check yourself

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.