Tag: Azure Services

Configure and deploy function apps (AI-200 Exam Prep)

This post is a part of the AI-200: Developing AI Cloud Solutions on Azure  Exam Prep Hub.
This topic falls under these sections:
Connect to and consume Azure services (20–25%)
   --> Develop and implement Azure Functions
      --> Configure and deploy function apps


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Azure Functions is a serverless compute service that enables developers to execute application code in response to events without managing the underlying server infrastructure.

For the AI-200: Developing AI Cloud Solutions on Azure exam, you should understand how to configure and deploy function apps, including:

  • Function app hosting plans
  • Function app configuration
  • Application settings
  • Runtime and operating-system configuration
  • Deployment methods
  • Zip deployment
  • Running functions from deployment packages
  • Deployment slots
  • Flex Consumption deployment
  • Continuous deployment
  • Configuration considerations for production
  • Common deployment problems and troubleshooting

The key exam skill is not simply knowing how to create a function app. You need to understand why you would choose a particular hosting or deployment approach for a given scenario.


1. What Is an Azure Function App?

An Azure Function is a piece of code that executes in response to a trigger.

A function app is the Azure resource that provides the execution environment for one or more functions.

For example, an AI application might contain functions that:

  1. Receive an HTTP request.
  2. Process a message from Azure Service Bus.
  3. Respond to an Event Grid event.
  4. Read a file uploaded to Azure Blob Storage.
  5. Process a timer event.
  6. Write results to a database.

The function app provides the common configuration and hosting environment for these functions.

Conceptually:

                    Azure Function App
                           |
          +----------------+----------------+
          |                |                |
      HTTP Function   Queue Function   Timer Function
          |                |                |
       REST API       AI Processing    Scheduled Job

Functions within the same function app generally share:

  • Runtime configuration
  • Application settings
  • Deployment configuration
  • Hosting resources
  • Some networking configuration
  • Monitoring configuration
  • Authentication configuration

Therefore, functions that have significantly different configuration or scaling requirements may be better placed in separate function apps.


2. Function App Hosting Plans

One of the most important concepts for AI-200 is understanding that the hosting plan affects scaling, cost, networking, deployment, and available features.

Current Azure Functions hosting options include:

  • Consumption
  • Flex Consumption
  • Elastic Premium
  • Dedicated/App Service
  • Azure Container Apps

The exact capabilities differ between plans.

Consumption Plan

The traditional Consumption plan is designed around serverless execution.

You generally pay based on function execution and resource consumption rather than maintaining dedicated compute capacity.

Characteristics include:

  • Automatic scaling
  • Serverless execution model
  • Consumption-based pricing
  • Potential cold starts
  • Limited control compared with Premium or Dedicated plans

The traditional Consumption plan should not be confused with Flex Consumption, which is the newer serverless option.


3. Flex Consumption

Flex Consumption is a newer Azure Functions hosting plan and is particularly important for current Azure development.

It is:

  • Linux-based
  • Serverless
  • Dynamically scalable
  • Consumption-based
  • Designed to provide more configuration flexibility than the traditional Consumption plan

Microsoft currently describes Flex Consumption as the recommended serverless hosting plan for Azure Functions.

Flex Consumption provides capabilities such as:

  • Configurable instance memory
  • Fast or large-scale-out options
  • Private networking
  • Always-ready instances for reducing cold starts
  • Support for deployment packages
  • Rolling updates for zero-downtime deployments

One particularly important exam distinction is that Flex Consumption uses a different deployment model from traditional Consumption.

Flex Consumption uses One Deploy as its deployment technology.

Important distinction

Do not assume:

“Zip deployment is the standard deployment method for every Functions hosting plan.”

That is no longer correct.

For example:

Hosting planDeployment approach
Flex ConsumptionOne Deploy
ConsumptionZip deploy and other supported methods
Elastic PremiumZip deploy and other supported methods
DedicatedZip deploy and other supported methods
Container AppsContainer-based deployment

4. Elastic Premium Plan

The Elastic Premium plan provides more control and capabilities than Consumption-based hosting.

It is useful when applications require features such as:

  • More predictable performance
  • Larger compute resources
  • VNet integration
  • Reduced cold-start impact
  • Longer-running workloads
  • More control over scaling

Premium plans also support deployment slots.

This can be useful when deploying AI applications where a new version needs to be tested before being exposed to production users.


5. Dedicated/App Service Plan

A Function App can also run on a dedicated App Service plan.

In this model, the application runs on dedicated App Service compute.

This can be appropriate when:

  • You already have App Service infrastructure.
  • Predictable compute capacity is required.
  • You want to run functions alongside other App Service workloads.
  • The workload does not fit the serverless consumption model.

The tradeoff is that you are paying for allocated compute capacity rather than relying exclusively on consumption-based serverless execution.


6. Azure Container Apps

Azure Functions can also be hosted in Azure Container Apps.

This approach is particularly useful when:

  • You want containerized Functions.
  • You need container-specific capabilities.
  • You want Azure Container Apps scaling and infrastructure.
  • Your application architecture already uses containers.

This is different from simply deploying function source code to a normal Function App.


7. Choosing the Hosting Plan

For the exam, think in terms of requirements.

RequirementLikely consideration
Serverless executionConsumption or Flex Consumption
Modern recommended serverless optionFlex Consumption
Private networking with serverless modelFlex Consumption
Reduce cold startsFlex Consumption/Premium
Predictable dedicated computeDedicated
Advanced scaling/performancePremium
Containerized FunctionsAzure Container Apps
Deployment slotsConsumption, Premium, Dedicated
Zero-downtime Flex deploymentRolling updates
Test deployment before productionDeployment slots where supported

The exam may give you a scenario and ask you to select the most appropriate hosting model.


8. Function App Configuration

After selecting the hosting environment, you need to configure the function app.

Important configuration areas include:

  • Runtime
  • Operating system
  • Application settings
  • Connection strings
  • Authentication
  • Networking
  • Storage
  • Monitoring
  • Deployment configuration

The configuration determines how the Functions runtime executes your code and accesses external services.


9. Application Settings

Application settings are environment variables made available to your function application.

They are commonly used for configuration such as:

FUNCTIONS_WORKER_RUNTIME
AzureWebJobsStorage
APPLICATIONINSIGHTS_CONNECTION_STRING
SERVICE_BUS_CONNECTION
DATABASE_CONNECTION
OPENAI_ENDPOINT

For example, an application might use:

SERVICE_BUS_CONNECTION

instead of embedding a Service Bus connection string directly in source code.

The application reads the setting at runtime.

This allows the same application code to be deployed into different environments:

Development
|
v
SERVICE_BUS_CONNECTION = Dev connection
Test
|
v
SERVICE_BUS_CONNECTION = Test connection
Production
|
v
SERVICE_BUS_CONNECTION = Production connection

This is a fundamental cloud-development practice.


10. Never Hard-Code Secrets

A common mistake is placing credentials directly into source code.

Avoid:

connectionString = "Endpoint=sb://...;SharedAccessKey=..."

Instead, use configuration and preferably a secure secret-management solution such as Azure Key Vault.

For example:

Function App
|
v
Managed Identity
|
v
Azure Key Vault
|
v
Secret

This allows the code to remain unchanged when credentials change.


11. Function App Settings and Restarts

Changes to function app settings can cause the application to restart.

This matters in production environments.

If an application setting is changed, developers should understand that the change isn’t necessarily a completely isolated configuration update with no runtime impact.

For production applications, configuration changes should therefore be managed carefully.


12. Runtime Configuration

A Function App must use a compatible Functions runtime and language stack.

Examples include:

  • .NET
  • Java
  • JavaScript/Node.js
  • Python
  • PowerShell

The runtime configuration must match the application being deployed.

For example, a Python function app should not be configured as a .NET runtime application.


13. The host.json File

The host.json file contains configuration settings that apply to the entire function app.

Examples of configuration areas include:

  • Logging
  • Extension behavior
  • Retry policies
  • Concurrency
  • Durable Functions behavior
  • HTTP configuration

A simplified example:

{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true
}
}
}
}

The host.json file is different from application settings.

host.json

Controls Functions host behavior.

Application settings

Provide environment-specific configuration and values to the application.

Understanding this distinction is important.


14. Deployment Methods

Azure Functions supports multiple deployment technologies.

The appropriate method depends on:

  • Hosting plan
  • Operating system
  • Development workflow
  • CI/CD requirements
  • Application architecture

Current deployment technologies include:

  • One Deploy
  • Zip deploy
  • External package URL
  • Docker/container deployment
  • Source control
  • Local Git
  • FTPS
  • In-portal editing

Not every method is supported for every hosting plan.


15. Zip Deployment

Zip deployment packages the function app into a .zip file and deploys it to Azure.

For Consumption, Elastic Premium, and Dedicated plans, zip deployment is the default and recommended deployment technology.

For example:

Function Project
|
v
Build
|
v
function.zip
|
v
Azure Function App

A ZIP package must contain the application files in the expected structure.

One important requirement is that host.json must be located at the root of the package.

Incorrect:

function.zip
|
+-- my-function-project
|
+-- host.json

Correct:

function.zip
|
+-- host.json
+-- Function1
+-- Function2
+-- requirements.txt

If the parent project directory is accidentally included, Azure Functions may not find the expected files.


16. Deploying with Azure CLI

For supported hosting plans, Azure CLI can be used to perform ZIP deployment.

A typical command is:

az functionapp deployment source config-zip \
-g <resource-group> \
-n <function-app-name> \
--src <zip-file>

This uploads the ZIP package to the Function App.

The important exam concept is not memorizing every CLI parameter.

Instead, recognize:

config-zip is associated with ZIP deployment for supported Function App hosting plans.


17. Run From Package

Azure Functions can also run directly from a deployment package instead of extracting the application files into the normal application directory.

For supported plans, this can be enabled with:

WEBSITE_RUN_FROM_PACKAGE=1

When enabled, the deployment package is mounted as a read-only filesystem.

Advantages include:

  • Reduced file-copy problems
  • More predictable deployments
  • Improved deployment performance
  • Verification of the exact package being executed
  • Reduced cold-start impact in some scenarios

18. Important Flex Consumption Deployment Difference

One of the most important current exam distinctions is:

Flex Consumption does not use traditional Zip Deploy.

Flex Consumption uses One Deploy.

With One Deploy, the application is packaged and uploaded to a deployment storage container. The Function App retrieves the package and runs the application from it.

Therefore:

Scenario:

You create a new Function App using the Flex Consumption plan. You want to deploy the application using the supported deployment mechanism.

The appropriate answer should point toward:

One Deploy, rather than traditional Zip Deploy.


19. Deployment Slots

Deployment slots allow supported Function Apps to have multiple environments associated with the same application.

For example:

Function App
|
+-- Production
|
+-- Staging

You can deploy a new version to the staging slot, test it, and then swap it with production.

The general process is:

Development
|
v
Staging Slot
|
Test
|
v
Swap
|
v
Production

This reduces the risk of deploying an untested version directly to production.


20. Deployment Slots and Hosting Plans

Deployment slots are not available on every hosting model.

Current slot support includes:

Hosting optionDeployment slots
ConsumptionProduction + 1 slot
Flex ConsumptionNot currently supported
PremiumProduction + multiple slots
DedicatedProduction + multiple slots
Container AppsUses revisions rather than Functions deployment slots

This is an excellent area for scenario-based exam questions.

Example

A developer wants to deploy a new version to staging and swap it into production. The Function App uses Flex Consumption.

The traditional deployment-slot solution is not available.

Flex Consumption instead supports zero-downtime deployment through its site update strategies, including rolling updates.


21. Continuous Deployment

For production applications, deployment is often automated through CI/CD.

A typical pipeline looks like:

Developer
|
v
Source Repository
|
v
Build
|
v
Automated Tests
|
v
Package
|
v
Azure Function App

Possible tools include:

  • GitHub Actions
  • Azure Pipelines
  • Azure CLI
  • Azure Functions Core Tools
  • Visual Studio Code
  • Infrastructure-as-code tools

The goal is to make deployments:

  • Repeatable
  • Automated
  • Testable
  • Auditable
  • Consistent

22. Development vs. Production Deployment

The deployment method should reflect the environment.

Development

A developer may deploy directly from:

  • Visual Studio Code
  • Azure Functions Core Tools
  • Azure CLI

This is convenient for rapid development.

Production

Production deployments should generally use an automated CI/CD process.

A production pipeline might:

  1. Build the application.
  2. Install dependencies.
  3. Run unit tests.
  4. Run security checks.
  5. Package the application.
  6. Deploy to a staging environment.
  7. Run validation tests.
  8. Promote the application to production.

23. Configuration by Environment

A common architecture is to keep application code identical across environments while changing configuration.

For example:

                Same Code
                    |
       +------------+------------+
       |            |            |
       v            v            v
 Development       Test      Production
       |            |            |
       v            v            v
 Dev settings    Test settings   Prod settings

This is preferable to maintaining three separate codebases.

Environment-specific values should be supplied through:

  • Application settings
  • Key Vault
  • Managed identity
  • App Configuration
  • CI/CD variables

24. Infrastructure as Code

Function Apps can also be deployed using infrastructure-as-code technologies such as:

  • Bicep
  • ARM templates
  • Terraform

This allows the application infrastructure to be described declaratively.

For example:

Infrastructure Definition
|
v
Resource Group
|
+-----+-----+
| |
v v
Function App Storage
|
v
Application Insights

Infrastructure as code is especially useful when deploying consistent development, test, and production environments.


25. Function App Storage

Azure Functions generally requires an associated storage account for runtime operations.

The storage account may be used for Functions platform requirements such as:

  • Host state
  • Trigger management
  • Function keys
  • Other runtime-related data

The exact storage requirements vary depending on the hosting model.

This is especially important when designing secure or network-restricted applications.


26. Monitoring Configuration

Production Function Apps should generally be integrated with Application Insights/Azure Monitor.

Monitoring can provide information about:

  • Requests
  • Exceptions
  • Dependencies
  • Performance
  • Traces
  • Availability
  • Failures

An application can then be diagnosed using telemetry rather than relying exclusively on application output.

For an AI application, this can be particularly valuable.

For example:

HTTP Request
|
v
Azure Function
|
+----> Azure OpenAI
|
+----> Cosmos DB
|
+----> Service Bus
|
v
Application Insights

Telemetry can help identify whether a slow request is caused by the function itself or by a downstream dependency.


27. Networking Considerations

Function Apps may need to communicate with resources that are not publicly accessible.

Examples include:

  • Azure SQL
  • Azure Database for PostgreSQL
  • Azure Storage
  • Azure Key Vault
  • Cosmos DB
  • Internal APIs

Depending on the hosting plan and architecture, networking features such as VNet integration and private endpoints can be used.

This is one reason hosting-plan selection matters.

A requirement such as:

“The serverless application must access resources through a private network.”

should cause you to carefully consider whether the selected hosting plan supports the required networking capabilities.

Flex Consumption specifically provides private networking capabilities.


28. Common Deployment Problems

Understanding deployment failures is useful for both real-world development and AI-200.

Problem 1: Incorrect ZIP structure

The package does not contain host.json at the root.

Result: Functions may not be discovered correctly.

Solution: Package the contents of the application directory rather than the parent directory.


Problem 2: Incorrect runtime

The Function App is configured for a different runtime than the deployed application.

Result: Functions may fail to start.

Solution: Verify the runtime and language stack.


Problem 3: Missing application setting

The function expects:

SERVICE_BUS_CONNECTION

but the setting isn’t configured.

Result: The function cannot connect to Service Bus.

Solution: Configure the required application setting or use a managed identity-based connection.


Problem 4: Deployment method incompatible with hosting plan

For example, attempting to use traditional Zip Deploy on Flex Consumption.

Result: The deployment approach isn’t supported.

Solution: Use the deployment technology appropriate for the hosting plan—One Deploy for Flex Consumption.


Problem 5: Expecting deployment slots on Flex Consumption

Flex Consumption currently does not support traditional deployment slots.

Solution: Use supported Flex Consumption site update strategies for zero-downtime deployment.


29. Key AI-200 Exam Distinctions

Memorize these concepts rather than isolated commands.

Function App vs. Function

Function

A unit of code triggered by an event.

Function App

The hosting and configuration environment for functions.


host.json vs. Application Settings

host.json

Controls Functions host behavior.

Application settings

Provide configuration and environment-specific values to the application.


Consumption vs. Flex Consumption

Consumption

Traditional serverless hosting option.

Flex Consumption

Modern serverless hosting option with additional configuration and networking capabilities.


Zip Deploy vs. One Deploy

Zip Deploy

Used with Consumption, Premium, and Dedicated plans.

One Deploy

The deployment technology for Flex Consumption.


Deployment Slots vs. Flex Rolling Updates

Deployment slots

Useful for supported hosting plans when you want to stage and swap deployments.

Flex Consumption

Doesn’t currently support deployment slots; use supported site update strategies such as rolling updates for zero-downtime deployments.


30. AI-200 Study Checklist

Before considering this topic mastered, make sure you can answer the following:

  • What is a Function App?
  • How does a Function differ from a Function App?
  • What are the major Azure Functions hosting plans?
  • What is the difference between Consumption and Flex Consumption?
  • Why would you choose Premium?
  • When would Dedicated hosting make sense?
  • What is host.json used for?
  • What are application settings?
  • Why shouldn’t secrets be hard-coded?
  • What is Zip Deploy?
  • What is One Deploy?
  • Which hosting plan requires One Deploy?
  • What does WEBSITE_RUN_FROM_PACKAGE do?
  • What are deployment slots?
  • Which plans support deployment slots?
  • What is the alternative to deployment slots in Flex Consumption?
  • How should production deployments be automated?
  • Why is CI/CD preferable for production?
  • How does Application Insights help troubleshoot Function Apps?
  • What are common deployment failures?

Practice Exam Questions

Question 1

A development team is creating a new Azure Function App using the Flex Consumption hosting plan. The team needs to deploy the application using the deployment technology supported by this hosting plan.

Which deployment technology should the team use?

A. Zip Deploy
B. FTP deployment
C. One Deploy
D. Local Git

Answer: C

Explanation:
Flex Consumption uses One Deploy as its deployment technology. Traditional Zip Deploy, FTP, and Local Git aren’t the deployment mechanism for Flex Consumption. One Deploy packages the application and stores the deployment package in the configured deployment storage.


Question 2

A Function App is configured with the following application setting:

SERVICEBUS_CONNECTION

The application uses this setting to obtain the connection information required to communicate with Azure Service Bus.

What is the primary purpose of an application setting in this scenario?

A. To define the Functions host version
B. To provide configuration values to the application at runtime
C. To define the HTTP trigger schema
D. To control the number of function instances

Answer: B

Explanation:
Application settings provide configuration values to the Function App and its code. They are commonly used for environment-specific configuration such as endpoints, connection information, and other runtime values. host.json, rather than an application setting, is used for many Functions host-level behaviors.


Question 3

A company deploys an Azure Function App to a supported hosting plan. Developers want to test a new version of the application before making it the production version. They want to deploy the new version separately and then swap it into production.

Which feature should they use?

A. Azure Event Grid
B. Function keys
C. Deployment slots
D. Application settings

Answer: C

Explanation:
Deployment slots allow supported Function Apps to run separate application instances such as staging and production. Developers can deploy and test the application in a staging slot and then swap the slot into production. Flex Consumption currently does not support traditional deployment slots.


Question 4

A developer creates a ZIP package for an Azure Function App. The ZIP file has this structure:

functionapp.zip
|
+-- MyFunctionProject
|
+-- host.json
+-- Function1
+-- Function2

The deployment succeeds, but Azure Functions cannot correctly locate the application files.

What is the most likely problem?

A. The ZIP package is too small
B. The Function App requires a deployment slot
C. host.json must be configured as an application setting
D. host.json isn’t located at the root of the deployment package

Answer: D

Explanation:
For ZIP deployment, host.json must be at the root of the extracted package. The common mistake is including the parent project directory inside the ZIP. The package should contain the application files directly at its root.


Question 5

A production Function App runs on a Consumption, Premium, or Dedicated plan. The development team wants to deploy the application as a ZIP package.

Which deployment technology should they generally use?

A. Zip Deploy
B. One Deploy
C. FTP only
D. Docker Compose

Answer: A

Explanation:
Zip Deploy is the default and recommended deployment technology for Function Apps running on Consumption, Elastic Premium, and Dedicated plans. Flex Consumption is the important exception because it uses One Deploy.


Question 6

An organization wants to run an Azure Functions application using a serverless hosting model. The application requires private networking capabilities and the organization wants to use a modern serverless Functions hosting option.

Which hosting plan is the best fit?

A. Dedicated App Service only
B. Flex Consumption
C. Classic Windows-only Consumption
D. Local development hosting

Answer: B

Explanation:
Flex Consumption is a Linux-based serverless hosting plan that provides additional capabilities such as private networking, configurable instance memory, and scaling options. It is currently Microsoft’s recommended serverless hosting plan for Azure Functions.


Question 7

A developer wants an Azure Function App to execute directly from a deployment package rather than copying the package contents into the normal application directory.

Which application setting is associated with running functions from a package for supported hosting plans?

A. FUNCTIONS_EXTENSION_VERSION
B. FUNCTIONS_WORKER_RUNTIME
C. WEBSITE_RUN_FROM_PACKAGE
D. SCM_DO_BUILD_DURING_DEPLOYMENT

Answer: C

Explanation:
WEBSITE_RUN_FROM_PACKAGE is used to configure supported Function Apps to run from a deployment package. When configured appropriately, the package is mounted as a read-only filesystem. Flex Consumption runs from a package by default and uses its own deployment model.


Question 8

A company has a Function App running on Flex Consumption. The development team wants to use the traditional deployment-slot model to deploy a staging version and then swap it into production.

What should the team do?

A. Create a second deployment slot
B. Enable FTP deployment
C. Convert the app to a Consumption plan automatically
D. Use a supported Flex Consumption site update strategy instead

Answer: D

Explanation:
Traditional deployment slots are not currently supported on Flex Consumption. Flex Consumption instead provides site update strategies, including rolling updates, for scenarios requiring zero-downtime deployments.


Question 9

A production Function App needs to access a database. The developer proposes putting the database password directly into the function’s source code.

Which approach is most appropriate?

A. Store the password in source control
B. Store the secret in Azure Key Vault and provide secure access through configuration or managed identity
C. Put the password in host.json
D. Store the password in the function name

Answer: B

Explanation:
Secrets should not be hard-coded into application source code or committed to source control. Azure Key Vault combined with managed identity is a strong approach for securely retrieving secrets. Application configuration can then provide non-secret configuration and references as appropriate.


Question 10

A development team is creating a production deployment pipeline for an Azure Function App. The team wants deployments to be repeatable and automatically tested before production deployment.

Which approach is most appropriate?

A. Manually upload files through the Azure portal for every release
B. Edit the production Function App directly in the portal
C. Use a CI/CD pipeline that builds, tests, packages, and deploys the Function App
D. Store production code only on the developer’s workstation

Answer: C

Explanation:
A CI/CD pipeline provides repeatable and automated deployment. A typical pipeline can build the application, run tests, package the application, deploy it to an appropriate environment, validate it, and promote it to production. This is much more reliable and auditable than manual production deployments.


Final Exam Takeaways

For AI-200 – Configure and deploy function apps, concentrate especially on the distinctions between hosting plans, configuration, and deployment technologies.

The highest-value concepts to remember are:

  1. A Function App provides the hosting environment for one or more functions.
  2. The hosting plan affects cost, scaling, networking, and deployment capabilities.
  3. Flex Consumption is the modern serverless Functions hosting option and is currently the recommended serverless plan.
  4. Flex Consumption uses One Deploy rather than traditional Zip Deploy.
  5. Zip Deploy is the recommended deployment technology for Consumption, Elastic Premium, and Dedicated plans.
  6. host.json controls Functions host behavior.
  7. Application settings provide runtime/environment configuration.
  8. Secrets should not be hard-coded into function code.
  9. Deployment slots allow supported hosting plans to stage and swap releases.
  10. Flex Consumption doesn’t currently support deployment slots.
  11. Flex Consumption can use rolling updates for zero-downtime deployments.
  12. WEBSITE_RUN_FROM_PACKAGE allows supported Function Apps to execute from a deployment package.
  13. ZIP packages must have host.json at the package root.
  14. CI/CD is the preferred approach for repeatable production deployments.
  15. Application Insights/Azure Monitor should be part of a production observability strategy.

These distinctions are particularly important because AI-200 scenario questions are likely to test which Azure Functions configuration or deployment approach best satisfies a set of requirements, rather than simply asking you to recall definitions.


Go to the AI-200 Exam Prep Hub main page

Configure and implement DAB deployment (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Secure, optimize, and deploy database solutions (35–40%)
   --> Integrate SQL solutions with Azure services
      --> Configure and implement DAB deployment


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Modern applications frequently require secure, scalable APIs to expose database objects without developers having to build and maintain extensive backend code. Data API Builder (DAB) is a Microsoft open-source runtime that automatically exposes Azure SQL Database, SQL Server, Azure Cosmos DB, PostgreSQL, and MySQL databases through REST and GraphQL endpoints.

While creating DAB configuration files is important, equally critical is deploying DAB securely and reliably into development, testing, staging, and production environments. The DP-800 exam expects SQL AI Developers to understand how DAB fits into CI/CD pipelines, containerized environments, Azure App Service, Azure Container Apps, Kubernetes, authentication systems, and infrastructure automation.

Understanding deployment strategies helps ensure that APIs remain secure, available, scalable, and maintainable.


What Is Data API Builder Deployment?

Deployment refers to the process of publishing the DAB runtime together with its configuration so that applications can consume database APIs.

A deployment includes:

  • Installing the DAB runtime
  • Providing the configuration file
  • Supplying environment variables
  • Configuring authentication
  • Connecting to databases
  • Deploying to the chosen hosting platform
  • Configuring monitoring
  • Configuring scaling
  • Managing updates

Unlike traditional applications, DAB is largely configuration-driven. Most deployments involve changing configuration rather than application code.


Common Deployment Targets

Microsoft supports several deployment options.

Local Development

Developers often begin locally using:

  • Windows
  • Linux
  • macOS

Example:

dab start

Advantages include:

  • Fast testing
  • Easy debugging
  • Local SQL Server integration
  • Rapid API validation

Local deployments should never expose production credentials.


Azure App Service

Azure App Service is one of the simplest production deployment options.

Benefits include:

  • Fully managed hosting
  • HTTPS enabled
  • Automatic scaling
  • Managed Identity
  • Deployment slots
  • Azure Monitor integration

Typical architecture:

Client
|
Azure App Service
|
Data API Builder
|
Azure SQL Database

Azure Container Apps

Many organizations package DAB inside a Docker container.

Advantages include:

  • Container portability
  • Autoscaling
  • Microservices architecture
  • Revision management
  • Simple CI/CD integration

Container Apps are becoming increasingly common for cloud-native solutions.


Azure Kubernetes Service (AKS)

Larger organizations often deploy DAB using Kubernetes.

Benefits include:

  • High availability
  • Rolling updates
  • Horizontal scaling
  • Container orchestration
  • Service mesh integration

Although AKS offers the most flexibility, it is also the most complex deployment option.


Docker

DAB is commonly deployed as a Docker container.

Example Dockerfile:

FROM mcr.microsoft.com/data-api-builder
COPY dab-config.json /App/

Benefits include:

  • Consistent environments
  • Easy version control
  • Portable deployments
  • Works across cloud providers

DAB Configuration During Deployment

Every deployment needs access to:

  • dab-config.json
  • Database connection information
  • Authentication settings
  • Runtime configuration

The configuration file should be packaged together with the deployment or mounted as a configuration volume.


Environment Variables

Production deployments should avoid hardcoded settings.

Instead, use environment variables.

Examples:

SQL_CONNECTION_STRING
AZURE_CLIENT_ID
AZURE_TENANT_ID
JWT_AUDIENCE

Benefits include:

  • Improved security
  • Easier environment changes
  • Better DevOps automation

Secure Connection Strings

Never store credentials directly inside configuration files.

Instead use:

  • Azure Key Vault
  • GitHub Secrets
  • Azure DevOps Library
  • Kubernetes Secrets
  • Environment variables

Example:

Instead of:

Password=MyPassword123

Use:

Password=${SQL_PASSWORD}

Managed Identity

One of Microsoft’s recommended deployment practices is using Managed Identity.

Instead of storing SQL credentials:

Application
|
Managed Identity
|
Azure SQL

Benefits include:

  • No stored passwords
  • Automatic credential rotation
  • Azure AD authentication
  • Reduced attack surface

DP-800 heavily emphasizes Managed Identity.


Authentication Configuration

Production deployments usually configure authentication providers such as:

  • Microsoft Entra ID
  • JWT providers
  • OAuth 2.0
  • Static development authentication (development only)

Authentication should be enabled before exposing APIs publicly.


HTTPS

Production DAB deployments should always use HTTPS.

Benefits include:

  • Encrypts traffic
  • Protects authentication tokens
  • Prevents packet interception
  • Supports secure REST and GraphQL endpoints

Azure App Service enables HTTPS automatically.


Reverse Proxies

Many production deployments place DAB behind:

  • Azure API Management
  • Azure Front Door
  • Azure Application Gateway
  • NGINX
  • Traefik

Advantages:

  • Centralized security
  • Rate limiting
  • Caching
  • Authentication
  • Request logging

CI/CD Deployment

DAB deployments fit naturally into DevOps pipelines.

Typical pipeline:

Developer
|
Git Repository
|
Build Pipeline
|
Unit Tests
|
Create Docker Image
|
Deploy
|
Smoke Tests
|
Production

Azure DevOps Deployment

Typical stages include:

  • Restore dependencies
  • Build
  • Validate DAB configuration
  • Build container
  • Push image
  • Deploy
  • Run validation tests

GitHub Actions

GitHub Actions commonly automate DAB deployment.

Example workflow:

Push
Build
Run Tests
Create Container
Publish Image
Deploy Azure

Infrastructure as Code

Many organizations deploy DAB using:

  • Bicep
  • ARM templates
  • Terraform

Benefits include:

  • Repeatability
  • Version control
  • Consistent infrastructure
  • Automated provisioning

Configuration Validation

Before deployment, validate:

  • JSON syntax
  • Entity definitions
  • Authentication settings
  • Database connectivity
  • GraphQL relationships
  • Stored procedure mappings

Validation reduces deployment failures.


Monitoring

Production deployments should include monitoring.

Useful Azure services include:

  • Azure Monitor
  • Application Insights
  • Log Analytics
  • Azure Diagnostics

Monitor:

  • Request latency
  • Errors
  • Authentication failures
  • API throughput
  • CPU
  • Memory

Logging

Logs assist troubleshooting.

Typical events:

  • Startup failures
  • Invalid requests
  • Authentication failures
  • Database connection errors
  • SQL execution errors

Logs should never expose sensitive information.


Scaling DAB

Scaling depends on the hosting platform.

Azure App Service

  • Scale up
  • Scale out

Azure Container Apps

  • Autoscaling
  • Revision-based deployments

AKS

  • Horizontal Pod Autoscaler
  • Multiple replicas

High Availability

Production deployments commonly use:

  • Multiple DAB instances
  • Load balancers
  • Regional redundancy
  • Health probes

These reduce downtime.


Deployment Slots

Azure App Service supports deployment slots.

Example:

Production
Staging Slot
Validation
Swap

Benefits:

  • Zero-downtime deployment
  • Easy rollback
  • Safe production updates

Versioning

Multiple API versions may run simultaneously.

Example:

v1
v2
v3

Benefits include:

  • Backward compatibility
  • Easier client migration
  • Controlled feature rollout

Rollback Strategy

Every deployment should support rollback.

Common methods:

  • Previous Docker image
  • Previous deployment slot
  • Previous Git tag
  • Previous release pipeline

Rollback minimizes production risk.


Security Best Practices

Recommended practices include:

  • HTTPS only
  • Managed Identity
  • Least privilege
  • Azure Key Vault
  • Authentication enabled
  • Authorization configured
  • Secure secrets
  • Monitor logs
  • Enable auditing
  • Disable unused endpoints

DP-800 Exam Tips

Remember these key points:

  • DAB deployments commonly use Azure App Service, Azure Container Apps, Docker, or AKS.
  • Avoid hardcoded secrets.
  • Prefer Managed Identity over SQL usernames/passwords.
  • Store secrets in Azure Key Vault.
  • Automate deployments using GitHub Actions or Azure DevOps.
  • Validate configurations before deployment.
  • Use deployment slots to minimize downtime.
  • Monitor deployments with Azure Monitor and Application Insights.
  • Use HTTPS for every production deployment.
  • Implement rollback strategies.

Practice Exam Questions

Question 1

Your organization wants to deploy Data API Builder with automatic operating system patching, built-in HTTPS, deployment slots, and minimal administrative overhead.

Which deployment target best meets these requirements?

A. Azure Kubernetes Service

B. Azure App Service

C. Self-managed virtual machine

D. Docker Desktop

Answer: B

Explanation: Azure App Service is a fully managed platform that provides HTTPS, automatic OS maintenance, deployment slots, autoscaling, and simplified application hosting.


Question 2

A company wants to eliminate database passwords from its DAB deployment while securely authenticating to Azure SQL Database.

What is the recommended authentication method?

A. Store SQL credentials in Git

B. Use SQL Authentication with encrypted passwords

C. Use Azure Managed Identity

D. Create a shared administrator account

Answer: C

Explanation: Managed Identity removes the need to store credentials, uses Microsoft Entra ID authentication, and automatically manages credential rotation.


Question 3

Which deployment practice provides the greatest protection for database connection strings?

A. Embed the connection string in the DAB configuration file

B. Store the connection string in application source code

C. Save credentials in a shared documentation file

D. Store secrets in Azure Key Vault and reference them during deployment

Answer: D

Explanation: Azure Key Vault securely stores secrets outside application code and integrates with Managed Identity and deployment pipelines.


Question 4

During deployment, a development team wants every code commit to automatically build, validate, test, and deploy DAB.

Which approach should they use?

A. Manual deployment using PowerShell

B. SQL Server Management Studio

C. A CI/CD pipeline using GitHub Actions or Azure DevOps

D. Windows Task Scheduler

Answer: C

Explanation: CI/CD pipelines automate builds, testing, validation, packaging, and deployment, reducing manual effort and deployment errors.


Question 5

Why should production DAB deployments use HTTPS?

A. It increases SQL query speed.

B. It compresses GraphQL responses.

C. It encrypts network communication between clients and the API.

D. It eliminates authentication requirements.

Answer: C

Explanation: HTTPS protects sensitive information such as authentication tokens and API traffic from interception during transmission.


Question 6

Which Azure service is specifically designed to collect application telemetry, performance metrics, and diagnostics for deployed DAB applications?

A. Azure Application Insights

B. Azure Storage Explorer

C. Azure Bastion

D. Azure Data Factory

Answer: A

Explanation: Application Insights provides monitoring, distributed tracing, diagnostics, performance metrics, and failure analysis for deployed applications.


Question 7

A team wants to release a new DAB version without interrupting production users and retain the ability to roll back immediately if problems occur.

Which Azure App Service feature should they use?

A. Reserved instances

B. Deployment slots

C. Availability zones

D. Geo-replication

Answer: B

Explanation: Deployment slots allow applications to be validated before swapping into production and enable quick rollback if issues are discovered.


Question 8

Why are environment variables commonly used during DAB deployment?

A. They automatically optimize SQL queries.

B. They eliminate authentication requirements.

C. They reduce GraphQL response sizes.

D. They separate configuration from application code and simplify deployment across environments.

Answer: D

Explanation: Environment variables allow different settings for development, testing, and production without modifying the application or configuration files.


Question 9

Which deployment platform provides the highest level of container orchestration and scalability for large enterprise DAB deployments?

A. Azure Kubernetes Service

B. Azure App Service

C. Windows Server

D. Docker Desktop

Answer: A

Explanation: AKS offers advanced orchestration, automatic scaling, rolling updates, service discovery, and high availability for enterprise containerized workloads.


Question 10

Before promoting a DAB deployment to production, what validation activity is most important?

A. Disable authentication temporarily.

B. Increase CPU resources.

C. Validate configuration files, authentication settings, and database connectivity.

D. Remove monitoring to improve performance.

Answer: C

Explanation: Validating configuration, connectivity, and authentication helps prevent deployment failures and ensures the API functions correctly before reaching production users.


Go to the DP-800 Exam Prep Hub main page