Data API Builder Configuration Files
This lesson explains what Data API builder does, the structure of its configuration file and the CLI commands that maintain it.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the data-source, runtime and entities sections.
- Identify the DAB CLI commands and their purposes.
- Explain how to keep secrets out of the configuration file.
What Data API builder does
Data API builder is a free, open-source engine that replaces most hand-written CRUD APIs. It reads a configuration file, connects to the database and serves endpoints for the tables, views and stored procedures listed as entities, with authentication, role-based authorization, pagination, filtering, caching and telemetry built in. It supports SQL Server, Azure SQL, SQL database in Fabric, Azure Cosmos DB, PostgreSQL and MySQL, and it runs anywhere as a stateless process or container. REST and GraphQL are served at the same time, and from version 1.7 the same entities are also available to AI agents through the SQL MCP Server endpoint.
The following diagram shows Data API builder serving database objects.

What DAB is
Structure of dab-config.json
The configuration file has three main sections, as the following example shows. data-source describes the database; runtime configures the REST, GraphQL and MCP endpoints and the host; and entities lists the exposed objects.
{
"$schema": "https://github.com/Azure/data-api-builder/releases/latest/download/dab.draft.schema.json",
"data-source": {
"database-type": "mssql",
"connection-string": "@env('SQL_CONNECTION_STRING')",
"options": { "set-session-context": true }
},
"runtime": {
"rest": { "enabled": true, "path": "/api" },
"graphql": { "enabled": true, "path": "/graphql", "allow-introspection": true },
"mcp": { "enabled": true, "path": "/mcp" },
"host": {
"mode": "development",
"cors": { "origins": ["https://app.contoso.com"] },
"authentication": { "provider": "Simulator" }
}
},
"entities": {
"Product": {
"source": { "object": "Catalog.Product", "type": "table" },
"permissions": [ { "role": "anonymous", "actions": ["read"] } ]
}
}
}Which section?
The DAB CLI and secrets
The DAB CLI, installed as a .NET tool (dotnet tool install -g microsoft.dataapibuilder), creates and edits the file so its structure stays valid, as the following table shows.
| Command | Purpose |
|---|---|
| dab init | Creates the file with the database type, connection string and host options |
| dab add | Adds an entity with its source, type and permissions |
| dab update | Changes an entity, for example adding relationships, fields or cache settings |
| dab configure | Changes runtime and data source settings |
| dab validate | Checks the file against the schema and the database |
| dab start | Runs the engine locally |
Connection strings and keys are never written into the file. @env('NAME') reads an environment variable (including from a local .env file), and @akv('name') reads an Azure Key Vault secret. With Microsoft Entra authentication, such as Authentication=Active Directory Default, the connection string contains no secret at all. Environment-specific files such as dab-config.Development.json override the base file when the DAB_ENVIRONMENT variable selects them.
DAB CLI commands
Starting a configuration safely
A developer must create a DAB configuration for an Azure SQL database that will be committed to Git and deployed to several environments with different databases. The connection must not appear in the repository. Which command starts the configuration?
Run dab init --database-type mssql --connection-string "@env('SQL_CONNECTION_STRING')" --host-mode development, then set SQL_CONNECTION_STRING per environment, ideally with Microsoft Entra authentication so it holds no password. The file can then be committed and reused everywhere. Putting the literal connection string in the file would commit it to Git, and maintaining one hand-edited file per environment duplicates every entity definition.
Which DAB syntax reads a secret from Azure Key Vault?
Show answer
@akv('secret-name'); @env('NAME') reads an environment variable.
Exam Tips
Remember for the exam
- Create the file: dab init; add objects: dab add; check it: dab validate.
- Three sections: data-source, runtime and entities.
- Keep secrets out: @env() or @akv(), or a passwordless Entra connection string.
- One configuration serves REST, GraphQL and MCP.