Skip to content

Commit f3a86fe

Browse files
committed
Add code links to sample code
1 parent 0cb77da commit f3a86fe

2 files changed

Lines changed: 43 additions & 24 deletions

File tree

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@
236236
"branch": "main",
237237
"branch_mapping": {}
238238
},
239+
{
240+
"path_to_root": "functions-flex-azure-files-samples",
241+
"url": "https://github.com/ggailey777/Azure-Functions-Flex-Consumption-with-Azure-Files-OS-Mount-Samples",
242+
"branch": "main",
243+
"branch_mapping": {}
244+
},
239245
{
240246
"path_to_root": "functions-quickstart-java-azd",
241247
"url": "https://github.com/Azure-Samples/azure-functions-java-flex-consumption-azd",

articles/azure-functions/tutorial-ffmpeg-processing-azure-files.md

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,32 @@ The sample code for this tutorial is in the [Azure Functions Flex Consumption wi
5555
azd init
5656
```
5757

58+
## Review the code
59+
60+
The three key pieces that make OS mount–based processing work are the infrastructure that creates the mount, the script that uploads the binary, and the function code that calls it.
61+
62+
### Mount configuration (Bicep)
63+
64+
The `mounts.bicep` module configures an Azure Files SMB mount on the function app. The `mountPath` value determines the local path where files appear at runtime:
65+
66+
:::code language="bicep" source="~/functions-flex-azure-files-samples/ffmpeg-image-processing/infra/app/mounts.bicep" :::
67+
68+
The mount is invoked from `main.bicep` with the share name and path:
69+
70+
:::code language="bicep" source="~/functions-flex-azure-files-samples/ffmpeg-image-processing/infra/main.bicep" range="194-212" :::
71+
72+
### Post-deployment script
73+
74+
After `azd up` deploys the infrastructure and code, a post-deployment script downloads the FFmpeg static binary and uploads it to the Azure Files share. It also creates the Event Grid subscription and runs a health check:
75+
76+
:::code language="bash" source="~/functions-flex-azure-files-samples/ffmpeg-image-processing/scripts/post-up.sh" range="33-65" :::
77+
78+
### Function code
79+
80+
The function reads the mount path from an environment variable (`FFMPEG_PATH`) that's set in the Bicep template. It calls `process_with_ffmpeg`, which runs the binary as a subprocess against the input image bytes:
81+
82+
:::code language="python" source="~/functions-flex-azure-files-samples/ffmpeg-image-processing/src/function_app.py" range="19-54" :::
83+
5884
## Deploy with Azure Developer CLI
5985
6086
This sample is an [Azure Developer CLI (azd)](/azure/developer/azure-developer-cli/overview) template. A single `azd up` command provisions infrastructure, deploys the function code, uploads the ffmpeg binary to Azure Files, and creates the EventGrid subscription for blob triggers.
@@ -93,51 +119,38 @@ This sample is an [Azure Developer CLI (azd)](/azure/developer/azure-developer-c
93119
94120
## Process an image
95121
96-
1. Upload a test image to the input container. The EventGrid subscription created during deployment automatically triggers your function when a blob is uploaded.
122+
1. Upload the sample image included in the repository to the input container. The event grid subscription created during deployment automatically triggers your function when a blob is uploaded.
97123
98124
```azurecli
99125
az storage blob upload \
100126
--container-name $INPUT_CONTAINER \
101-
--name sample_image.jpg \
102-
--file <path-to-a-local-image> \
127+
--name sample_image.png \
128+
--file sample_image.png \
103129
--account-name $STORAGE_ACCOUNT \
104130
--auth-mode login
105131
```
106132
107-
Replace `<path-to-a-local-image>` with the path to any `.jpg` or `.png` file on your computer.
108-
109133
> [!TIP]
110134
> If the trigger doesn't fire immediately, wait 10-15 seconds, and then check the function's execution logs in the Azure portal.
111135
112-
1. Check the function logs to confirm the image was processed:
113-
114-
```azurecli
115-
az functionapp log tail \
116-
--resource-group $RESOURCE_GROUP \
117-
--name $FUNCTION_APP_NAME
118-
```
119-
120-
Expected output:
121-
122-
```
123-
Executing 'ProcessImageFunction' (Reason='New blob detected', Id=12345)
124-
Image processing started for sample_image.jpg
125-
FFmpeg conversion completed successfully
126-
Executed 'ProcessImageFunction' (Succeeded, Id=12345, Duration=2765ms)
127-
```
128-
129-
1. List and download the converted image:
136+
1. Verify the function processed the image by listing the blobs in the output container:
130137
131138
```azurecli
132139
az storage blob list \
133140
--container-name $OUTPUT_CONTAINER \
134141
--account-name $STORAGE_ACCOUNT \
135142
--auth-mode login \
136143
-o table
144+
```
137145
146+
You should see `sample_image.jpg` in the output container.
147+
148+
1. Download the converted image:
149+
150+
```azurecli
138151
az storage blob download \
139152
--container-name $OUTPUT_CONTAINER \
140-
--name sample_image_converted.png \
153+
--name sample_image.png \
141154
--file ./output_image.png \
142155
--account-name $STORAGE_ACCOUNT \
143156
--auth-mode login

0 commit comments

Comments
 (0)