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
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-cli-samples.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ The following table includes links to bash scripts for Azure Functions that use
26
26
|---|---|
27
27
|[Create a function app and connect to a storage account](scripts/functions-cli-create-function-app-connect-to-storage-account.md)| Create a function app and connect it to a storage account. |
28
28
|[Create a function app and connect to an Azure Cosmos DB](scripts/functions-cli-create-function-app-connect-to-cosmos-db.md)| Create a function app and connect it to an Azure Cosmos DB. |
29
+
|[Create a Python function app and mount a Azure Files share](scripts/functions-cli-mount-files-storage-linux.md)| By mounting a share to your Linux function app, you can leverage existing machine learning models or other data in your functions. |
# Quickstart: Create a function in Azure that responds to HTTP requests
@@ -18,15 +18,20 @@ Before you begin, you must have the following:
18
18
19
19
+ An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
20
20
21
+
::: zone pivot="programming-language-csharp,programming-language-javascript,programming-language-typescript,programming-language-powershell"
21
22
+ The [Azure Functions Core Tools](./functions-run-local.md#v2) version 2.7.1846 or a later 2.x version.
23
+
::: zone-end
24
+
::: zone pivot="programming-language-python"
25
+
+ Python 3.6 and 3.7 require [Azure Functions Core Tools](./functions-run-local.md#v2) version 2.7.1846 or a later 2.x version. Python 3.8 requires [version 3.x](./functions-run-local.md#v2) of the Core Tools.
26
+
::: zone-end
22
27
23
28
+ The [Azure CLI](/cli/azure/install-azure-cli) version 2.0.76 or later.
24
29
::: zone pivot="programming-language-javascript,programming-language-typescript"
25
30
+[Node.js](https://nodejs.org/), Active LTS and Maintenance LTS versions (8.11.1 and 10.14.1 recommended).
26
31
::: zone-end
27
32
28
33
::: zone pivot="programming-language-python"
29
-
+[Python 3.7](https://www.python.org/downloads/release/python-375/) or [Python 3.6](https://www.python.org/downloads/release/python-368/), which are supported by Azure Functions. Python 3.8 and later versions aren't yet supported.
34
+
+[Python 3.8](https://www.python.org/downloads/release/python-382/), [Python 3.7](https://www.python.org/downloads/release/python-375/), [Python 3.6](https://www.python.org/downloads/release/python-368/), which are supported by Azure Functions.
@@ -46,11 +51,11 @@ Before you begin, you must have the following:
46
51
+ Run `node --version` to check your Node.js version reports 8.x or 10.x.
47
52
::: zone-end
48
53
::: zone pivot="programming-language-python"
49
-
+ Run `python --version` (Linux/MacOS) or `py --version` (Windows) to check your Python version reports 3.7.x or 3.6.x.
54
+
+ Run `python --version` (Linux/MacOS) or `py --version` (Windows) to check your Python version reports 3.8.x, 3.7.x or 3.6.x.
50
55
51
56
## <aname="create-venv"></a>Create and activate a virtual environment
52
57
53
-
In a suitable folder, run the following commands to create and activate a virtual environment named `.venv`. Be sure to use Python 3.7 or 3.6, which are supported by Azure Functions.
58
+
In a suitable folder, run the following commands to create and activate a virtual environment named `.venv`. Be sure to use Python 3.8, 3.7 or 3.6, which are supported by Azure Functions.
54
59
55
60
56
61
# [bash](#tab/bash)
@@ -263,10 +268,12 @@ Use the following Azure CLI commands to create these items. Each command provide
263
268
264
269
The storage account incurs only a few cents (USD) for this quickstart.
265
270
266
-
1. Create the Functions app using the [az functionapp create](/cli/azure/functionapp#az-functionapp-create) command. In the following example, replace `<STORAGE_NAME>` with the name of the account you used in the previous step, and replace `<APP_NAME>` with a globally unique name appropriate to you. The `<APP_NAME>` is also the default DNS domain for the function app.
271
+
1. Create the function app using the [az functionapp create](/cli/azure/functionapp#az-functionapp-create) command. In the following example, replace `<STORAGE_NAME>` with the name of the account you used in the previous step, and replace `<APP_NAME>` with a globally unique name appropriate to you. The `<APP_NAME>` is also the default DNS domain for the function app.
267
272
268
273
::: zone pivot="programming-language-python"
269
-
If you are using Python 3.6, also change `--runtime-version` to `3.6`.
274
+
If you are using Python 3.8, change `--runtime-version` to `3.8` and `--functions_version` to `3`.
275
+
276
+
If you are using Python 3.6, change `--runtime-version` to `3.6`.
270
277
271
278
```azurecli
272
279
az functionapp create --resource-group AzureFunctionsQuickstart-rg --os-type Linux --consumption-plan-location westeurope --runtime python --runtime-version 3.7 --functions_version 2 --name <APP_NAME> --storage-account <STORAGE_NAME>
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-reference-python.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -390,7 +390,18 @@ For local development, application settings are [maintained in the local.setting
390
390
391
391
## Python version
392
392
393
-
Currently, Azure Functions supports both Python 3.6.x and 3.7.x (official CPython distributions). When running locally, the runtime uses the available Python version. To request a specific Python version when you create your function app in Azure, use the `--runtime-version` option of the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command. Version change is allowed only on Function App creation.
393
+
Azure Functions supports the following Python versions:
394
+
395
+
| Functions version | Python<sup>*</sup> versions |
396
+
| ----- | ----- |
397
+
| 3.x | 3.8<br/>3.7<br/>3.6 |
398
+
| 2.x | 3.7<br/>3.6 |
399
+
400
+
<sup>*</sup>Official CPython distributions
401
+
402
+
To request a specific Python version when you create your function app in Azure, use the `--runtime-version` option of the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command. The Functions runtime version is set by the `--functions-version` option. The Python version is set when the function app is created and can't be changed.
403
+
404
+
When running locally, the runtime uses the available Python version.
title: Mount a file share to a Python function app - Azure CLI
3
+
description: Create a serverless Python function app and mount an existing file share using the Azure CLI.
4
+
ms.topic: sample
5
+
ms.date: 03/01/2020
6
+
---
7
+
8
+
# Mount a file share to a Python function app using Azure CLI
9
+
10
+
This Azure Functions sample script creates a function app and creates a share in Azure Files. It them mounts the share so that the data can be accessed by your functions.
11
+
12
+
>[!NOTE]
13
+
>The function app created runs on Python version 3.7. Azure Functions also [supports Python versions 3.6 and 3.8](../functions-reference-python.md#python-version).
If you choose to install and use the CLI locally, this article requires that you are running the Azure CLI version 2.0 or later. Run `az --version` to find the version. If you need to install or upgrade, see [Install the Azure CLI](/cli/azure/install-azure-cli). Examples are written for Bash shell and must be modified to run in a Windows command prompt.
20
+
21
+
## Sample script
22
+
23
+
This script creates an Azure Function app using the [Consumption plan](../functions-scale.md#consumption-plan).
24
+
25
+
[!code-azurecli-interactive[main](../../../cli_scripts/azure-functions/functions-cli-mount-files-storage-linux/functions-cli-mount-files-storage-linux.sh"Create an Azure Function on a Consumption plan")]
Each command in the table links to command specific documentation. This script uses the following commands:
32
+
33
+
| Command | Notes |
34
+
|---|---|
35
+
|[az group create](/cli/azure/group#az-group-create)| Creates a resource group in which all resources are stored. |
36
+
|[az storage account create](/cli/azure/storage/account#az-storage-account-create)| Creates an Azure Storage account. |
37
+
|[az functionapp create](/cli/azure/functionapp#az-functionapp-create)| Creates a function app. |
38
+
|[az storage share create](/cli/azure/storage/share#az-storage-share-create)| Creates an Azure Files share in storage account. |
39
+
|[az storage directory create](/cli/azure/storage/directory#az-storage-directory-create)| Creates a directory in the share. |
40
+
|[az webapp config storage-account add](/cli/azure/webapp/config/storage-account#az-webapp-config-storage-account-add)| Mounts the share to the function app. |
41
+
|[az webapp config storage-account list](/cli/azure/webapp/config/storage-account#az-webapp-config-storage-account-list)| Shows file shares mounted to the function app. |
42
+
43
+
## Next steps
44
+
45
+
For more information on the Azure CLI, see [Azure CLI documentation](/cli/azure).
46
+
47
+
Additional Azure Functions CLI script samples can be found in the [Azure Functions documentation](../functions-cli-samples.md).
Copy file name to clipboardExpand all lines: articles/azure-functions/storage-considerations.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,25 @@ Azure Storage encrypts all data in a storage account at rest. For more informati
53
53
54
54
By default, data is encrypted with Microsoft-managed keys. For additional control over encryption keys, you can supply customer-managed keys to use for encryption of blob and file data. These keys must be present in Azure Key Vault for Functions to be able to access the storage account. To learn more, see [Configure customer-managed keys with Azure Key Vault by using the Azure portal](../storage/common/storage-encryption-keys-portal.md).
55
55
56
+
## Mount file shares (Linux)
57
+
58
+
You can mount existing Azure Files shares to your Linux function apps. By mounting a share to your Linux function app, you can leverage existing machine learning models or other data in your functions. You can use the [`az webapp config storage-account add`](/cli/azure/webapp/config/storage-account#az-webapp-config-storage-account-add) command to mount an existing share to your Linux function app.
59
+
60
+
In this command, `share-name` is the name of the existing Azure Files share, and `custom-id` can be any string that uniquely defines the share when mounted to the function app. Also, `mount-path` is the path from which the share is accessed in your function app. `mount-path` must be in the format `/dir-name`, and it can't start with `/home`.
61
+
62
+
For a complete example, see the scripts in [Create a Python function app and mount a Azure Files share](scripts/functions-cli-mount-files-storage-linux.md).
63
+
64
+
Currently, only a `storage-type` of `AzureFiles` is supported. You can only mount five shares to a given function app. Mounting a file share may increase the cold start time by at least 200-300ms, or even more when the storage account is in a different region.
65
+
66
+
The mounted share is available to your function code at the `mount-path` specified. For example, when `mount-path` is `/path/to/mount`, you can access the target directory by file system APIs, as in the following Python example:
0 commit comments