You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#customer intent: As a developer, I want to deploy a Durable Functions app on the Flex Consumption plan with Azure Files storage mounts so I can analyze multiple text files in parallel without managing infrastructure.
11
12
---
@@ -17,24 +18,23 @@ In this tutorial, you deploy a Python Azure Functions app that uses [Durable Fun
17
18
In this tutorial, you:
18
19
19
20
> [!div class="checklist"]
20
-
> * Deploy a Durable Functions app in a Flex Consumption plan with a mounted Azure Files share using Bicep
21
-
> * Upload sample text files to the mounted Azure Files share
22
-
> * Deploy a Python function app that uses a [fan-out/fan-in pattern](./durable-functions-fan-in-fan-out.md?pivots=durable-functions) to analyze text files in parallel
23
-
> * Trigger an orchestration to process the files and verify results
21
+
> * Deploy a Durable Functions app in a Flex Consumption plan with a mounted Azure Files share by using Azure Developer CLI
22
+
> * Trigger an orchestration to process sample text files in parallel
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
30
-
-[Azure CLI](/cli/azure/install-azure-cli) version 2.60.0 or later
31
-
-[Azure Functions Core Tools](../functions-run-local.md) version 4.x or later
32
-
-[Python 3.9 or later](https://www.python.org/downloads/)
30
+
-[Azure Developer CLI (azd)](/azure/developer/azure-developer-cli/install-azd) version 1.9.0 or later
33
31
-[Git](https://git-scm.com/)
34
32
35
-
## Clone the repository
33
+
The CLI examples in this tutorial use Bash syntax and have been tested in [Azure Cloud Shell](/azure/cloud-shell/overview) (Bash) and Linux/macOS terminals.
36
34
37
-
The sample code for this tutorial is in the [Azure Functions Flex Consumption with Azure Files OS Mount Samples](https://github.com/Azure-Samples/Azure-Functions-Flex-Consumption-with-Azure-Files-OS-Mount-Samples) GitHub repository. The `durable-text-analysis` folder contains the function app code and a Bicep template that provisions the required Azure resources.
35
+
## Initialize the sample project
36
+
37
+
The sample code for this tutorial is in the [Azure Functions Flex Consumption with Azure Files OS Mount Samples](https://github.com/Azure-Samples/Azure-Functions-Flex-Consumption-with-Azure-Files-OS-Mount-Samples) GitHub repository. The `durable-text-analysis` folder contains the function app code, a Bicep template that provisions the required Azure resources, and a post-deployment script that uploads sample text files.
38
38
39
39
1. Open a terminal and navigate to the directory where you want to clone the repository.
40
40
@@ -50,196 +50,61 @@ The sample code for this tutorial is in the [Azure Functions Flex Consumption wi
50
50
cd Azure-Functions-Flex-Consumption-with-Azure-Files-OS-Mount-Samples/durable-text-analysis
51
51
```
52
52
53
-
## Create Azure resources
54
-
55
-
This tutorial uses Bicep to automate resource creation.
56
-
57
-
1. Sign in to Azure:
58
-
59
-
```azurecli
60
-
az login
61
-
```
62
-
63
-
1. If you have multiple subscriptions, set the one you want to use:
64
-
65
-
```azurecli
66
-
az account set --subscription <YOUR_SUBSCRIPTION_ID>
67
-
```
68
-
69
-
1. Create a resource group:
70
-
71
-
```azurecli
72
-
RESOURCE_GROUP="rg-durable-text"
73
-
LOCATION="eastus"
74
-
75
-
az group create --name $RESOURCE_GROUP --location $LOCATION
76
-
```
77
-
78
-
1. Deploy infrastructure by using Bicep:
79
-
80
-
```azurecli
81
-
az deployment group create \
82
-
--resource-group $RESOURCE_GROUP \
83
-
--template-file infra/main.bicep \
84
-
--parameters infra/main.bicepparam
85
-
```
86
-
87
-
This deployment creates the following resources:
88
-
89
-
- Storage account with an Azure Files share
90
-
- Durable Functions app in a Flex Consumption plan
91
-
- Application Insights for monitoring
92
-
- Managed identity with permissions to the storage account
93
-
94
-
1. After the deployment succeeds, save the resource names for later steps:
> If you're using Azure Cloud Shell, shell variables don't persist between sessions. If your session times out, rerun the variable assignments in this section before continuing.
116
-
117
-
## Verify the storage mount configuration
118
-
119
-
1. The Bicep deployment creates the Azure Files share and configures the mount on your functionapp. Verify that it's set up correctly:
120
-
121
-
```azurecli
122
-
az storage share list \
123
-
--account-name $STORAGE_ACCOUNT \
124
-
--query "[].name" \
125
-
-o table
126
-
```
127
-
128
-
Expected output:
129
-
130
-
```
131
-
Name
132
-
------
133
-
text-data
134
-
```
135
-
136
-
1. Verify the mount configuration on the function app:
137
-
138
-
```azurecli
139
-
az functionapp config appsettings list \
140
-
--resource-group $RESOURCE_GROUP \
141
-
--name $FUNCTION_APP_NAME \
142
-
| grep -i mount
143
-
```
144
-
145
-
> [!TIP]
146
-
> The storage mount typically appears at `/mnt/filedata` inside the function container. Your app settings map this local path to the Azure Files share.
147
-
148
-
If you don't see mount configuration settings, manually configure the mount in the Azure portal under **Settings**>**Configuration**>**Path Mappings**.
149
-
150
-
## Upload sample text files
151
-
152
-
1. Create local sample files:
53
+
1. Initialize the `azd` environment. When prompted, enter an environment name such as `durable-text`:
153
54
154
55
```bash
155
-
mkdir -p sample_texts
156
-
cat > sample_texts/file1.txt << 'EOF'
157
-
Azure Functions is a serverless compute service that lets you run code on-demand without managing infrastructure.
158
-
EOF
159
-
160
-
cat > sample_texts/file2.txt << 'EOF'
161
-
Durable Functions extends Azure Functions with workflow capabilities like orchestration and state management.
162
-
EOF
163
-
164
-
cat > sample_texts/file3.txt << 'EOF'
165
-
Azure Files provides managed file shares in the cloud accessible via the SMB protocol.
166
-
EOF
56
+
azd init
167
57
```
168
58
169
-
1. Upload files to the Azure Files share:
170
-
171
-
```azurecli
172
-
STORAGE_KEY=$(az storage account keys list \
173
-
--resource-group $RESOURCE_GROUP \
174
-
--account-name $STORAGE_ACCOUNT \
175
-
--query "[0].value" \
176
-
-o tsv)
59
+
## Deploy with Azure Developer CLI
177
60
178
-
az storage file upload-batch \
179
-
--destination $SHARE_NAME \
180
-
--source sample_texts \
181
-
--account-name $STORAGE_ACCOUNT \
182
-
--account-key $STORAGE_KEY
183
-
```
61
+
This sample is an [Azure Developer CLI (azd)](/azure/developer/azure-developer-cli/overview) template. A single `azd up`command provisions infrastructure, deploys the functioncode, and uploads sample text files to the Azure Files share.
184
62
185
-
1. Verify the upload:
63
+
1. Sign in to Azure:
186
64
187
-
```azurecli
188
-
az storage file list \
189
-
--share-name $SHARE_NAME \
190
-
--account-name $STORAGE_ACCOUNT \
191
-
--account-key $STORAGE_KEY \
192
-
-o table
65
+
```bash
66
+
azd auth login
193
67
```
194
68
195
-
Expected output:
69
+
1. Provision and deploy everything:
196
70
197
-
```
198
-
Name
199
-
------
200
-
file1.txt
201
-
file2.txt
202
-
file3.txt
71
+
```bash
72
+
azd up
203
73
```
204
74
205
-
## Prepare and deploy the function app
75
+
When prompted, selecttheAzure subscription and location to use. The command then:
206
76
207
-
1. Make sure the remote function app has the required app settings. Run this command even if these settings already exist:
77
+
- Creates a resource group, storage account, Flex Consumption functionapp with a Durable Functions configuration, Application Insights instance, and managed identity
78
+
- Deploys the Python functioncode
79
+
- Uploads sample text files to the Azure Files share
80
+
- Runs a health check
208
81
209
-
```azurecli
210
-
az functionapp config appsettings set \
211
-
--resource-group $RESOURCE_GROUP \
212
-
--name $FUNCTION_APP_NAME \
213
-
--settings MOUNT_PATH=/mnt/filedata
214
-
```
82
+
The deployment takes a few minutes. When it completes, you see a summary of the created resources.
215
83
216
-
1. Publish the function app to Azure. The `--build remote` flag installs Python dependencies on the server, so you don't need to install them locally:
84
+
1. Save resource names as shell variables forthe remaining steps:
0 commit comments