Skip to content
Category: SQL Server
2026-04-22

Expose your database as an API in minutes (Data API Builder for Azure Databases)

One of the biggest bottlenecks in application development is API creation. Even though there are very powerful frameworks, they still require time, maintenance, and an additional layer of complexity.

This is where Data API Builder (DAB) comes into play — a tool that shifts the paradigm: instead of building an API on top of the database, it generates it directly from it.

What is Data API Builder?

Data API Builder is an open‑source tool from Microsoft designed to automatically expose databases as REST and GraphQL APIs.

It is specifically designed to work with:

  • Azure SQL Database
  • SQL Server
  • PostgreSQL
  • Azure Cosmos DB

Its main advantage is that it eliminates the need to build a traditional backend for many use cases.

What problem does it solve?

In a typical scenario:

  1. You have a database
  2. You need an API
  3. You build a backend (Node, .NET, Python…)
  4. You add endpoints, security, validations…

With DAB, that flow is simplified:

  1. You have a database
  2. You define a configuration
  3. You already have an API

This reduces:

  • Development time
  • Maintenance costs
  • Architectural complexity

Simplified architecture

Without DAB:

Frontend → Backend → Database

With DAB:

Frontend → Data API Builder → Database

It removes an entire layer.

How it actually works

Data API Builder acts as an intermediate layer that:

  • It connects to the database
  • It interprets the configuration
  • It generates endpoints dynamically
  • It applies security rules

All of this through a single configuration file (dab-config.json).

When to choose DAB vs. a traditional backend

ScenarioDABTraditional backend
Fast MVP
Simple CRUD
Complex logic
High control
Advanced integrations

Deployment

Requirements

First of all, we need to understand what we’re installing:

  • .NET Runtime: the environment required to run applications built with .NET. Data API Builder is built on .NET, so it needs this runtime to work.
  • NuGet: the package manager for .NET. It allows you to download tools and libraries, such as Data API Builder.
  • Data API Builder (DAB)

1. Install .NET 8 Runtime

Download and install version 8.0.25:

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-8.0.25-windows-x64-installer


The following steps are executed in CMD

2. Add the NuGet repository

In some environments, it’s necessary to add NuGet manually:

dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

3. Install Data API Builder

dotnet tool install --global Microsoft.DataApiBuilder

This will install the dab command on your system.


4. Prepare the environment

We create a folder where the API configuration will live:

mkdir C:\dab-demo
cd C:\dab-demo

This folder will contain the dab-config.json file, which defines how the database is exposed.


5. Initialize Data API Builder

dab init --database-type "mssql" ^
  --host-mode "Development" ^
  --connection-string "Server=.\natillas;Database=BlogDemo;User Id=natilla;Password=natilla;TrustServerCertificate=true;Encrypt=true;"

This command:

  • Connects to SQL Server
  • Generates the configuration file
  • Prepares the API

6. Add entities (tables)

dab add Customers --source "dbo.Customers" --permissions "anonymous:*"
dab add Orders --source "dbo.Orders" --permissions "anonymous:*"
dab add OrderItems --source "dbo.OrderItems" --permissions "anonymous:*"

Here we are indicating which tables we want to expose as an API.

The permission anonymous:* allows full access without authentication (for testing only).


7. Start the API

dab start

Available endpoints

Once Data API Builder is running, it automatically exposes several endpoints that allow us to interact with the data in different ways. This is especially useful because, without developing any backend, we already have a complete API with built‑in documentation.

The main generated endpoints are shown below:

  • Swagger (OpenAPI): provides a visual interface to explore and test the available endpoints without needing external tools.
    http://localhost:5000/swagger

These endpoints allow you to quickly verify that the API is working correctly and serve as a foundation for integrations with applications, dashboards, or analytics tools.

What did we just do?

In a few steps we have achieved:

  • Connect to SQL Server
  • Generate an API automatically
  • Expose REST endpoints
  • Have GraphQL available with zero code

All of this without developing a traditional backend.


Netx steps

Once we have the API running, the next step is to evolve the project toward a more realistic, production‑ready environment.

Real security (roles)

In the example we used open permissions (anonymous:*), which is useful for testing but not suitable for production environments.

Data API Builder allows you to define:

  • Access roles (for example: anonymous, authenticated)
  • Entity‑level permissions
  • Operation‑level restrictions (read, write, etc.)

This makes it possible to control who can access which data and how, while also integrating with authentication systems such as Azure Entra ID.

Deployment in Azure

Once the local setup is validated, the next step is to move the API to the cloud.

A typical deployment would include:

  • Azure App Service to host Data API Builder
  • Azure SQL Database as the database
  • Managed Identity to handle authentication without credentials
  • Environment variables to configure the connection

This makes it possible to have a fully managed, scalable API that can be accessed from any application.


Conclusion

Data API Builder is a tool that fits perfectly in scenarios where speed and simplicity are key.

It doesn’t replace a full backend, but it does cover a large percentage of cases where what you really need is simply to expose data.

If you work with Azure and databases… it’s definitely worth trying.

Articles in the SQL Server 2025 Series

Complete este formulario para recibir la guía de Windows Server en Azure
*Obligatorio
Complete este formulario para recibir la guía de Windows Server en Azure
Gracias por rellenar el formulario [name]. ¡Aquí tienes tu eBook Gratis!
Complete este formulario para recibir 4 best practices to implement a comprehensive Zero Trust security approach
*Obligatorio
Complete este formulario para recibir 4 best practices to implement a comprehensive Zero Trust security approach
Gracias por rellenar el formulario [name]. ¡Aquí tienes tu eBook Gratis!
Complete este formulario para recibir Cloud Migration Essentials
*Obligatorio
Complete este formulario para recibir Cloud Migration Essentials
Gracias por rellenar el formulario [name]. ¡Aquí tienes tu eBook Gratis!
Complete este formulario para recibir Cloud security Advice for Nonprofit Leaders
*Obligatorio
Complete este formulario para recibir Cloud security Advice for Nonprofit Leaders
Gracias por rellenar el formulario [name]. ¡Aquí tienes tu eBook Gratis!
Complete este formulario para recibir Prevent data leaks with Microsoft 365 Business Premium
*Obligatorio
Complete este formulario para recibir Prevent data leaks with Microsoft 365 Business Premium
Gracias por rellenar el formulario [name]. ¡Aquí tienes tu eBook Gratis!
Complete this form to recieve the guide of Windows Server on Azure
*Required
Complete this form to recieve the guide of Windows Server on Azure
Thank you for filling out the form [name]. Here's your Free eBook!
Complete this form to recieve 4 best practices to implement a comprehensive Zero Trust security approach
*Required
Complete this form to recieve 4 best practices to implement a comprehensive Zero Trust security approach
Thank you for filling out the form [name]. Here's your Free eBook!
Complete this form to recieve Cloud Migration Essentials
*Required
Complete this form to recieve Cloud Migration Essentials
Thank you for filling out the form [name]. Here's your Free eBook!
Complete this form to recieve Cloud security Advice for Nonprofit Leaders
*Required
Complete este formulario para recibir Cloud security Advice for Nonprofit Leaders
Thank you for filling out the form [name]. Here's your Free eBook!
Complete this form to recieve Prevent data leaks with Microsoft 365 Business Premium
*Obligatorio
Complete this form to recieve Prevent data leaks with Microsoft 365 Business Premium
Thank you for filling out the form [name]. Here's your Free eBook!
Complete this form to recieve Cloud Migration Simplified Ebook.
*Obligatorio
Complete this form to recieve Prevent data leaks with Microsoft 365 Business Premium
Thank you for filling out the form [name]. Here's your Free eBook!