Skip to content

Commit 18829dd

Browse files
Merge pull request #53461 from JeffKoMS/build-backends-azure-functions
New module: Build backends azure functions
2 parents e162d2e + 85b8a9c commit 18829dd

19 files changed

Lines changed: 815 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.introduction
3+
title: Introduction
4+
metadata:
5+
title: Introduction
6+
description: Introduction to building serverless AI backends with Azure Functions
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 3
12+
content: |
13+
[!include[](includes/1-introduction.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.understand-hosting-scaling
3+
title: Understand Azure Functions hosting and scaling for AI workloads
4+
metadata:
5+
title: Understand Azure Functions Hosting and Scaling for AI Workloads
6+
description: Understand Azure Functions hosting and scaling for AI workloads
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 12
12+
content: |
13+
[!include[](includes/2-understand-hosting-scaling.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.set-up-local-development-environment
3+
title: Set up the local development environment for Functions
4+
metadata:
5+
title: Set Up the Local Development Environment for Functions
6+
description: Set up the local development environment for Functions
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 11
12+
content: |
13+
[!include[](includes/3-set-up-local-development-environment.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.create-triggers-bindings-ai-patterns
3+
title: Create triggers and bindings for AI integration patterns
4+
metadata:
5+
title: Create Triggers and Bindings for AI Integration Patterns
6+
description: Create triggers and bindings for AI integration patterns
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 16
12+
content: |
13+
[!include[](includes/4-create-triggers-bindings-ai-patterns.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.manage-secrets-configuration
3+
title: Manage secrets and configuration in Functions
4+
metadata:
5+
title: Manage Secrets and Configuration in Functions
6+
description: Manage secrets and configuration in Functions
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 10
12+
content: |
13+
[!include[](includes/5-manage-secrets-configuration.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.configure-identity-access
3+
title: Configure identity and access for Functions
4+
metadata:
5+
title: Configure Identity and Access for Functions
6+
description: Configure identity and access for Functions
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 14
12+
content: |
13+
[!include[](includes/6-configure-identity-access.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.exercise-create-mcp-server
3+
title: Exercise - Create an MCP server with Azure Functions
4+
metadata:
5+
title: Exercise - Create an MCP Server with Azure Functions
6+
description: Exercise - Create an MCP server with Azure Functions
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 25
12+
content: |
13+
[!include[](includes/7-exercise-create-mcp-server.md)]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.knowledge-check
3+
title: Module assessment
4+
metadata:
5+
title: Module Assessment
6+
description: Module assessment
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 5
12+
content: "Choose the best response for each of the following questions."
13+
quiz:
14+
questions:
15+
- content: "Your AI inference function experiences cold start latency of several seconds because it loads large ML libraries and initializes connections to Azure AI services. You need to reduce latency for the first request while keeping costs low during idle periods. Which approach should you use?"
16+
choices:
17+
- content: "Use the Flex Consumption plan with always-ready instances configured for the function"
18+
isCorrect: true
19+
explanation: "Correct. The Flex Consumption plan's always-ready feature lets you keep a minimum number of warm instances for latency-sensitive functions while other functions scale to zero. This provides cold start mitigation for critical endpoints without paying for always-on infrastructure across the entire app."
20+
- content: "Use the Consumption plan with increased function timeout settings"
21+
isCorrect: false
22+
explanation: "Incorrect. The Consumption plan doesn't provide always-ready instances, and function timeout settings don't affect cold start behavior. Timeout settings only control how long a function can run after it starts executing."
23+
- content: "Use the Premium plan with pre-warmed workers disabled"
24+
isCorrect: false
25+
explanation: "Incorrect. Disabling pre-warmed workers in the Premium plan would expose the function to cold starts. The Premium plan's value for eliminating cold starts comes from its pre-warmed workers, which keep at least one instance always running."
26+
27+
- content: "You're setting up a local development environment for Azure Functions. Your function app uses a Service Bus queue trigger, but you notice the trigger doesn't fire when you run the function locally. What is the most likely cause?"
28+
choices:
29+
- content: "The AzureWebJobsStorage setting in local.settings.json isn't configured with a valid storage connection"
30+
isCorrect: true
31+
explanation: "Correct. The Azure Functions runtime requires a storage account connection (AzureWebJobsStorage) to manage internal operations such as trigger coordination and state tracking. Without a valid connection to Azure Storage or the Azurite emulator, non-HTTP triggers like Service Bus triggers don't work locally."
32+
- content: "The function app needs to be deployed to Azure before Service Bus triggers can be tested"
33+
isCorrect: false
34+
explanation: "Incorrect. Service Bus triggers can be tested locally using Azure Functions Core Tools, provided the runtime storage dependency is configured and a valid Service Bus connection string is available. Local testing doesn't require deployment to Azure."
35+
- content: "Visual Studio Code doesn't support debugging Service Bus-triggered functions"
36+
isCorrect: false
37+
explanation: "Incorrect. Visual Studio Code with the Azure Functions extension fully supports debugging Service Bus-triggered functions locally. The extension attaches the debugger to Core Tools, which processes all supported trigger types."
38+
39+
- content: "Your function processes documents asynchronously. An HTTP endpoint accepts requests, writes messages to a Service Bus queue, and a separate queue-triggered function performs the processing. You want to configure the queue trigger to process one message at a time per instance to maximize CPU and memory available for each document. Which configuration should you use?"
40+
choices:
41+
- content: "Set maxConcurrentCalls to 1 in the serviceBus section of host.json"
42+
isCorrect: true
43+
explanation: "Correct. The maxConcurrentCalls property in host.json controls how many messages each instance processes simultaneously. Setting it to 1 ensures each message gets the full instance resources, which is appropriate for resource-intensive AI processing tasks."
44+
- content: "Set batchSize to 1 in the serviceBus section of host.json"
45+
isCorrect: false
46+
explanation: "Incorrect. The batchSize property applies to Azure Storage Queue triggers, not Service Bus triggers. Service Bus triggers use maxConcurrentCalls to control parallel message processing per instance."
47+
- content: "Set maxDequeueCount to 1 on the Service Bus queue resource"
48+
isCorrect: false
49+
explanation: "Incorrect. maxDeliveryCount (not maxDequeueCount) is configured on the Service Bus queue resource and controls how many times a message is retried before moving to the dead-letter queue. It doesn't affect concurrency within the function."
50+
51+
- content: "You need to store an API key for an Azure AI service in your function app's configuration. The security team requires that the key be stored in Azure Key Vault and rotated regularly without requiring application redeployment. Which approach meets these requirements?"
52+
choices:
53+
- content: "Create a Key Vault reference in the application setting using a versionless secret URI"
54+
isCorrect: true
55+
explanation: "Correct. Key Vault references with versionless URIs automatically resolve to the latest secret version. The runtime re-resolves references periodically (within 24 hours) or immediately when any configuration change triggers an app restart, allowing rotated secrets to be picked up without redeploying the application."
56+
- content: "Create a Key Vault reference in the application setting using a versioned secret URI"
57+
isCorrect: false
58+
explanation: "Incorrect. A versioned secret URI pins the reference to a specific secret version. When the secret is rotated, you must update the application setting with the new version identifier, which requires manual intervention and doesn't meet the requirement to avoid redeployment."
59+
- content: "Store the API key directly in the application setting with encryption enabled"
60+
isCorrect: false
61+
explanation: "Incorrect. While Azure encrypts application settings at rest, storing the key directly in application settings doesn't meet the requirement to store it in Key Vault. When the key rotates, you must update the application setting manually."
62+
63+
- content: "You're configuring identity-based connections for a Service Bus trigger in your function app. You've enabled a system-assigned managed identity and set ServiceBusConnection__fullyQualifiedNamespace to your namespace. The function fails to receive messages. What role assignment is missing?"
64+
choices:
65+
- content: "Azure Service Bus Data Receiver on the Service Bus namespace"
66+
isCorrect: true
67+
explanation: "Correct. Identity-based connections for Service Bus triggers require the Azure Service Bus Data Receiver role to be assigned to the function app's managed identity on the Service Bus namespace. This role grants permission to receive messages from queues and subscriptions."
68+
- content: "Azure Service Bus Data Owner on the Service Bus namespace"
69+
isCorrect: false
70+
explanation: "Incorrect. While Azure Service Bus Data Owner would grant sufficient permissions, it provides more access than necessary. The principle of least privilege recommends using Azure Service Bus Data Receiver for triggers that only need to receive messages."
71+
- content: "Key Vault Secrets User on the Service Bus namespace"
72+
isCorrect: false
73+
explanation: "Incorrect. Key Vault Secrets User is a role for Azure Key Vault, not Service Bus. Identity-based connections to Service Bus use Service Bus-specific roles like Azure Service Bus Data Receiver."
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.build-backends-azure-functions.summary
3+
title: Summary
4+
metadata:
5+
title: Summary
6+
description: Summary
7+
ms.date: 02/13/2026
8+
author: jeffkoms
9+
ms.author: jeffko
10+
ms.topic: unit
11+
durationInMinutes: 2
12+
content: |
13+
[!include[](includes/9-summary.md)]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
AI solutions require lightweight, event-driven compute to handle tasks such as serving inference requests, processing data pipelines, and integrating with external services. This module guides you through building serverless AI backends with Azure Functions to create responsive, cost-efficient, and secure endpoints that scale automatically with demand.
2+
3+
Imagine you're a developer at a company building an intelligent document processing pipeline. The system receives documents through an API, extracts text using an Azure AI service, classifies the content, and stores the results in a database. The current architecture runs on dedicated virtual machines that sit idle most of the day but struggle to keep up during peak upload windows. Operational costs are climbing because the VMs run around the clock, and the team spends significant effort maintaining the infrastructure. Your manager asks you to move the processing logic to a serverless architecture that scales with actual demand and charges only for execution time. You need an HTTP endpoint that accepts document uploads, a queue-based processor that handles classification asynchronously, and output bindings that write results to storage. Each component must securely access Azure AI services and databases without embedding credentials in code. The client expects the new system to handle bursts of several hundred concurrent requests while keeping average response latency under 500 milliseconds. You choose Azure Functions because it provides event-driven triggers, built-in bindings to Azure services, and flexible hosting plans that let you balance cold start latency against cost. Building this solution requires understanding how Functions scales, how to develop and debug locally, and how to properly manage secrets and identity.
4+
5+
After completing this module, you'll be able to:
6+
7+
- Evaluate cold start, scaling, and instance memory trade-offs when choosing between Flex Consumption and Premium hosting for AI workloads.
8+
- Set up a local development environment for Azure Functions using Core Tools, emulators, and an IDE.
9+
- Create triggers and bindings that implement common AI integration patterns such as HTTP inference endpoints and queue-based batch processors.
10+
- Configure secrets management and application settings using Key Vault references and Azure App Configuration.
11+
- Apply managed identity and function-level authorization to secure access between Functions and other Azure resources.
12+
13+
> [!NOTE]
14+
> All code examples in this module are based on the most recent version of the Azure Functions libraries at the time of writing. The libraries are updated often and the recommendation is to visit the [Azure Functions Python developer guide](/azure/azure-functions/functions-reference-python) for the most up-to-date information.

0 commit comments

Comments
 (0)