Skip to content

Commit 7f73339

Browse files
committed
Adding Azure Files OS mount quickstarts and tutorials. Updating consumption plan notes.
1 parent 518bb47 commit 7f73339

6 files changed

Lines changed: 1007 additions & 17 deletions

articles/azure-functions/TOC.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@
5656
- name: Run scheduled tasks
5757
displayName: timer trigger, schedule
5858
href: scenario-scheduled-tasks.md
59+
- name: Using external dependencies or large files via Azure Files mounts
60+
items:
61+
- name: Durable text analysis
62+
displayName: Azure Files, OS mount, Durable Functions, Flex Consumption
63+
href: quickstart-durable-text-analysis-azure-files.md
64+
- name: FFmpeg image processing
65+
displayName: Azure Files, OS mount, ffmpeg, Flex Consumption
66+
href: quickstart-ffmpeg-processing-azure-files.md
5967
- name: Developer tools
6068
items:
6169
- name: Azure Developer CLI
@@ -117,7 +125,10 @@
117125
href: functions-twitter-email.md
118126
- name: Host MCP servers for AI-enabled functions
119127
displayName: agent, agentic, Foundry
120-
href: functions-mcp-tutorial.md
128+
href: functions-mcp-tutorial.md
129+
- name: Shared file access with Azure Files OS mounts
130+
displayName: Azure Files, OS mount, Flex Consumption, shared files
131+
href: tutorial-shared-file-access-azure-files.md
121132
- name: Develop Python functions with VS Code
122133
href: ./create-first-function-vs-code-python.md
123134
- name: Create serverless APIs using Visual Studio

articles/azure-functions/consumption-plan.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ ms.custom:
1313
When you're using the Consumption plan, instances of the Azure Functions host are dynamically added and removed based on the number of incoming events.
1414

1515
[!INCLUDE [functions-linux-consumption-retirement](../../includes/functions-linux-consumption-retirement.md)]
16-
17-
The Consumption plan scales automatically, even during periods of high load. When running functions in a Consumption plan, you're charged for compute resources only when your functions are running. On a Consumption plan, a function execution times out after a configurable period of time.
16+
The Consumption plan scales automatically in response to demand. With this plan, you're billed only for the compute resources used while your functions are running, and function execution times out after a configurable period.
1817

1918
> [!TIP]
2019
> [!INCLUDE [functions-flex-consumption-recommended-serverless](../../includes/functions-flex-consumption-recommended-serverless.md)]
@@ -25,20 +24,6 @@ Billing is based on number of executions, execution time, and memory used. Usage
2524

2625
To learn more about how to estimate costs when running in a Consumption plan, see [Understanding Consumption plan costs](functions-consumption-costs.md).
2726

28-
## Create a Consumption plan function app
29-
30-
When you create a function app in the Azure portal, the Consumption plan is the default. When using APIs to create your function app, you don't have to first create an App Service plan as you do with Premium and Dedicated plans.
31-
32-
In Consumption plan hosting, each function app typically runs in its own plan. In the Azure portal or in code, you might also see the Consumption plan referred to as `Dynamic` or `Y1`.
33-
34-
Use the following links to learn how to create a serverless function app in a Consumption plan, either programmatically or in the Azure portal:
35-
36-
- [Azure CLI](functions-cli-samples.md#create)
37-
- [Azure portal](./functions-get-started.md)
38-
- [Azure Resource Manager template](functions-create-first-function-resource-manager.md)
39-
40-
You can also create function apps in a Consumption plan when you publish a Functions project from [Visual Studio Code](./how-to-create-function-vs-code.md#create-the-function-app-in-azure) or [Visual Studio](functions-create-your-first-function-visual-studio.md#publish-the-project-to-azure).
41-
4227
## Multiple apps in the same plan
4328

4429
The general recommendation is for each function app to have its own Consumption plan. However, if needed, function apps in the same region can be assigned to the same Consumption plan. Keep in mind that there's a [limit to the number of function apps that can run in a Consumption plan](functions-scale.md#service-limits). Function apps in the same plan still scale independently of each other.
Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
---
2+
title: "Quickstart: Durable text analysis with Azure Files OS mount"
3+
description: Learn how to deploy a Python Azure Functions app that uses Durable Functions to orchestrate parallel text file analysis by using an Azure Files OS mount on a Flex Consumption plan.
4+
ms.service: azure-functions
5+
ms.topic: quickstart
6+
ms.date: 03/11/2026
7+
ms.custom:
8+
- devx-track-azurecli
9+
- devx-track-python
10+
#customer intent: As a developer, I want to deploy a Durable Functions app on the Flex Consumption plan with Azure Files OS mounts so I can analyze multiple text files in parallel without managing infrastructure.
11+
---
12+
13+
# Quickstart: Durable text analysis with Azure Files OS mount
14+
15+
In this quickstart, you deploy a Python Azure Functions app that uses [Durable Functions](./durable/durable-functions-overview.md) to orchestrate parallel text file analysis. Your function app mounts an Azure Files share, analyzes multiple text files in parallel (fan-out), aggregates the results (fan-in), and returns them to the caller.
16+
17+
This quickstart demonstrates a key advantage of OS mounts: shared file access across multiple function instances without per-request network overhead.
18+
19+
[!INCLUDE [functions-azure-files-samples-note](../../includes/functions-azure-files-samples-note.md)]
20+
21+
## Prerequisites
22+
23+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
24+
- [Azure CLI](/cli/azure/install-azure-cli) version 2.60.0 or later.
25+
- [Azure Functions Core Tools](./functions-run-local.md) version 4.x or later.
26+
- [Python 3.9 or later](https://www.python.org/downloads/).
27+
- [Git](https://git-scm.com/).
28+
29+
## What you'll build
30+
31+
You deploy an application with the following components:
32+
33+
- **Orchestrator function**: Receives a trigger to analyze a folder of text files. Reads the mount point, discovers files, and fans out parallel analysis tasks.
34+
- **Activity functions**: Each activity analyzes one file, computing word count, character count, and mock sentiment.
35+
- **Azure Files mount**: A shared network path mounted on your function app, accessible to all instances.
36+
37+
When you trigger the orchestration, it:
38+
39+
1. Connects to your mounted Azure Files share.
40+
1. Lists all text files in a folder.
41+
1. Starts parallel analysis tasks (one per file).
42+
1. Waits for all tasks to complete (fan-in).
43+
1. Returns aggregated results.
44+
45+
## Clone the repository
46+
47+
```bash
48+
git clone https://github.com/Azure-Samples/Azure-Functions-Flex-Consumption-with-Azure-Files-OS-Mount-Samples.git
49+
cd Azure-Functions-Flex-Consumption-with-Azure-Files-OS-Mount-Samples/durable-text-analysis
50+
```
51+
52+
## Create Azure resources
53+
54+
This quickstart uses Bicep to automate resource creation. Alternatively, you can create resources manually in the Azure portal.
55+
56+
### Sign in to Azure
57+
58+
```bash
59+
az login
60+
az account set --subscription <YOUR_SUBSCRIPTION_ID>
61+
```
62+
63+
### Create a resource group
64+
65+
```bash
66+
RESOURCE_GROUP="rg-durable-text"
67+
LOCATION="eastus"
68+
69+
az group create --name $RESOURCE_GROUP --location $LOCATION
70+
```
71+
72+
### Deploy infrastructure with Bicep
73+
74+
```bash
75+
az deployment group create \
76+
--resource-group $RESOURCE_GROUP \
77+
--template-file infra/main.bicep \
78+
--parameters infra/main.bicepparam
79+
```
80+
81+
This deployment creates the following resources:
82+
83+
- Storage account with an Azure Files share
84+
- Flex Consumption function app plan
85+
- Azure Functions app
86+
- Application Insights for monitoring
87+
- Managed identity with permissions to the storage account
88+
89+
After the deployment succeeds, save the resource names for later steps:
90+
91+
```bash
92+
STORAGE_ACCOUNT=$(az deployment group show --resource-group $RESOURCE_GROUP --name main --query properties.outputs.storageAccountName.value -o tsv)
93+
FUNCTION_APP_NAME=$(az deployment group show --resource-group $RESOURCE_GROUP --name main --query properties.outputs.functionAppName.value -o tsv)
94+
SHARE_NAME="text-data"
95+
96+
echo "Storage Account: $STORAGE_ACCOUNT"
97+
echo "Function App: $FUNCTION_APP_NAME"
98+
echo "Share Name: $SHARE_NAME"
99+
```
100+
101+
## Verify the Azure Files mount
102+
103+
The Bicep deployment creates the Azure Files share and configures the mount on your function app.
104+
105+
### Verify the storage share exists
106+
107+
```bash
108+
az storage share list --account-name $STORAGE_ACCOUNT --query "[].name" -o table
109+
```
110+
111+
Expected output:
112+
113+
```
114+
Name
115+
------
116+
text-data
117+
```
118+
119+
### Verify mount configuration on the function app
120+
121+
```bash
122+
az functionapp config appsettings list --resource-group $RESOURCE_GROUP --name $FUNCTION_APP_NAME | grep -i mount
123+
```
124+
125+
> [!TIP]
126+
> The OS mount typically appears at `/mnt/filedata` inside the function container. Your app settings map this local path to the Azure Files share.
127+
128+
## Upload sample text files
129+
130+
### Create local sample files
131+
132+
```bash
133+
mkdir -p sample_texts
134+
cat > sample_texts/file1.txt << 'EOF'
135+
Azure Functions is a serverless compute service that lets you run code on-demand without managing infrastructure.
136+
EOF
137+
138+
cat > sample_texts/file2.txt << 'EOF'
139+
Durable Functions extends Azure Functions with workflow capabilities like orchestration and state management.
140+
EOF
141+
142+
cat > sample_texts/file3.txt << 'EOF'
143+
Azure Files provides managed file shares in the cloud accessible via the SMB protocol.
144+
EOF
145+
```
146+
147+
### Upload files to the Azure Files share
148+
149+
```bash
150+
STORAGE_KEY=$(az storage account keys list --resource-group $RESOURCE_GROUP --account-name $STORAGE_ACCOUNT --query "[0].value" -o tsv)
151+
152+
az storage file upload-batch \
153+
--destination $SHARE_NAME \
154+
--source sample_texts \
155+
--account-name $STORAGE_ACCOUNT \
156+
--account-key $STORAGE_KEY
157+
```
158+
159+
Verify the upload:
160+
161+
```bash
162+
az storage file list --share-name $SHARE_NAME --account-name $STORAGE_ACCOUNT --account-key $STORAGE_KEY -o table
163+
```
164+
165+
Expected output:
166+
167+
```
168+
Name
169+
------
170+
file1.txt
171+
file2.txt
172+
file3.txt
173+
```
174+
175+
## Deploy the function app
176+
177+
### Install dependencies
178+
179+
```bash
180+
pip install -r requirements.txt
181+
```
182+
183+
### Configure local settings
184+
185+
```bash
186+
cp local.settings.json.example local.settings.json
187+
```
188+
189+
Edit `local.settings.json` to include your mount path:
190+
191+
```json
192+
{
193+
"IsEncrypted": false,
194+
"Values": {
195+
"FUNCTIONS_WORKER_RUNTIME": "python",
196+
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=<your-account>;...",
197+
"MOUNT_PATH": "/mnt/filedata"
198+
}
199+
}
200+
```
201+
202+
### Publish to Azure
203+
204+
```bash
205+
func azure functionapp publish $FUNCTION_APP_NAME --build remote
206+
```
207+
208+
## Trigger the orchestration
209+
210+
### Get the function URL
211+
212+
```bash
213+
HOST_KEY=$(az functionapp keys list --resource-group $RESOURCE_GROUP --name $FUNCTION_APP_NAME --query "functionKeys.default" -o tsv)
214+
215+
FUNCTION_URL="https://${FUNCTION_APP_NAME}.azurewebsites.net/api/orchestrators/TextAnalysisOrchestrator"
216+
```
217+
218+
### Start the orchestration
219+
220+
```bash
221+
curl -X POST "$FUNCTION_URL" \
222+
-H "x-functions-key: $HOST_KEY" \
223+
-H "Content-Type: application/json" \
224+
-d '{}'
225+
```
226+
227+
The response includes an instance ID and status query URIs:
228+
229+
```json
230+
{
231+
"id": "abc123def456",
232+
"statusQueryGetUri": "https://...",
233+
"sendEventPostUri": "https://...",
234+
"terminatePostUri": "https://..."
235+
}
236+
```
237+
238+
## Verify results
239+
240+
### Check orchestration status
241+
242+
Use the `statusQueryGetUri` from the previous response, or construct the URL manually:
243+
244+
```bash
245+
INSTANCE_ID="<instance-id-from-trigger-response>"
246+
247+
curl "https://${FUNCTION_APP_NAME}.azurewebsites.net/api/orchestrators/TextAnalysisOrchestrator/${INSTANCE_ID}" \
248+
-H "x-functions-key: $HOST_KEY"
249+
```
250+
251+
While the orchestration is running, the `runtimeStatus` is `Running`. When complete, the response looks like:
252+
253+
```json
254+
{
255+
"name": "TextAnalysisOrchestrator",
256+
"instanceId": "abc123def456",
257+
"runtimeStatus": "Completed",
258+
"output": {
259+
"results": [
260+
{
261+
"file": "file1.txt",
262+
"word_count": 15,
263+
"char_count": 98,
264+
"sentiment": "positive"
265+
},
266+
{
267+
"file": "file2.txt",
268+
"word_count": 18,
269+
"char_count": 120,
270+
"sentiment": "positive"
271+
},
272+
{
273+
"file": "file3.txt",
274+
"word_count": 12,
275+
"char_count": 85,
276+
"sentiment": "neutral"
277+
}
278+
],
279+
"total_words": 45,
280+
"total_chars": 303,
281+
"analysis_duration_seconds": 2.34
282+
}
283+
}
284+
```
285+
286+
> [!TIP]
287+
> Your function app accessed all three files in parallel through the OS mount. No per-request network calls were needed. The function read them directly from the mounted share by using standard file I/O. This approach demonstrates the power of OS mounts combined with Durable Functions.
288+
289+
## Clean up resources
290+
291+
To avoid ongoing charges, delete the resource group when you no longer need the resources:
292+
293+
```bash
294+
az group delete --name $RESOURCE_GROUP --yes
295+
```
296+
297+
> [!WARNING]
298+
> This command deletes the resource group and all resources in it, including the function app, storage account, and Application Insights instance.
299+
300+
## Troubleshooting
301+
302+
| Issue | Resolution |
303+
| --- | --- |
304+
| **Mount path not found** | Verify the mount is configured in the Azure portal under **Settings** > **Configuration** > **Path Mappings**. |
305+
| **Permission denied when reading files** | Verify the storage account access key in the mount configuration is correct and hasn't been rotated. OS mounts use storage account keys, not managed identity RBAC. |
306+
| **Deployment failed** | Check the Bicep parameters file (`infra/main.bicepparam`). Ensure all required values are set and the storage account name is globally unique. |
307+
| **Orchestration timed out** | Increase `maxRetryInterval` in `function_app.py` if your files are large or your analysis is slow. |
308+
309+
## Related content
310+
311+
- [Durable Functions overview](./durable/durable-functions-overview.md)
312+
- [Tutorial: Shared file access patterns with Azure Files OS mounts](./tutorial-shared-file-access-azure-files.md)
313+
- [Quickstart: FFmpeg image processing with Azure Files OS mount](./quickstart-ffmpeg-processing-azure-files.md)
314+
- [Flex Consumption plan](./flex-consumption-plan.md)
315+
- [Storage considerations for Azure Functions](./storage-considerations.md)

0 commit comments

Comments
 (0)