Deploying Data API Builder to Azure
This lesson explains the hosting options for DAB, how to supply its configuration and the settings for production.
Learning outcomes
After completing this lesson, you will be able to:
- Compare the Azure hosting options for DAB.
- Describe how the configuration and secrets reach the container.
- Identify the settings for a secure production deployment.
Hosting options
The official image mcr.microsoft.com/azure-databases/data-api-builder runs the engine with a configuration file. Hosting options are compared in the following table.
| Host | Strengths |
|---|---|
| Azure Container Apps | Serverless containers, autoscaling (including to zero), revisions, HTTPS ingress, built-in authentication, managed identity |
| Azure App Service (Web App for Containers) | Familiar web hosting, deployment slots, App Service authentication |
| Azure Container Instances | Simple single containers for tests or small workloads |
| Azure Kubernetes Service | Teams that already run Kubernetes and need fine control |
Where to host DAB
Supplying the configuration
The container needs the configuration file and the values it references. The file can be built into a custom image derived from the official one, or mounted from storage such as an Azure Files share into the container's app directory. Environment variables supply @env() values, and @akv() reads Key Vault secrets with the container's identity. The following steps describe a typical Azure Container Apps deployment.
-
Prepare the configuration
Set host mode to production, the EntraId authentication provider with audience and issuer, CORS origins, and Application Insights telemetry; validate with dab validate.
-
Create the identity
Create a user-assigned managed identity, create a database user for it FROM EXTERNAL PROVIDER, and grant only the permissions the entities need.
-
Package the configuration
Build a custom image with the file, or store the file in Azure Files and mount it.
-
Create the container app
Deploy the image with ingress enabled, the managed identity assigned, and environment variables such as the passwordless connection string.
-
Automate
Add the steps to a pipeline that validates the configuration and creates a new revision on each change.
Deploying DAB to Container Apps
Production settings
In production, host.mode is production, which disables the Swagger UI and the Nitro GraphQL client and reduces logging. The connection string uses Authentication=Active Directory Managed Identity (with the client ID of a user-assigned identity) or Default, and the database user has only the permissions needed by the configured entities. Health checks at /health report endpoint and entity status for probes, and telemetry goes to Application Insights or OpenTelemetry. Multiple instances share a Redis level 2 cache when caching is used.
Deploying without secrets
A team deploys DAB to Azure Container Apps. Security requires no passwords for the database connection, and the API must accept only Microsoft Entra tokens for the company's app registration. What should the deployment include?
Assign a managed identity to the container app, create a matching database user with least-privilege permissions, use a connection string with Managed Identity (or Default) authentication supplied through an environment variable, and set the authentication provider to EntraId with the app registration's audience and the tenant's issuer, in production mode. Storing a SQL password in a Container Apps secret still uses a password, and leaving the provider as Unauthenticated would treat every caller as anonymous.
Which DAB features are turned off in production host mode?
Show answer
The Swagger UI and the Nitro GraphQL client, and logging becomes less verbose.
Exam Tips
Remember for the exam
- Recommended Azure host: Azure Container Apps with the official DAB image.
- Database access: managed identity mapped to a least-privilege database user.
- Production: host mode production, EntraId provider, CORS origins, telemetry.
- Supply the config by building it into an image or mounting it from Azure Files.