|
| 1 | +--- |
| 2 | +title: Mount a file share to a Python function app - Azure CLI |
| 3 | +description: Create a serverless Python function app and mpunt 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.6. Python version 3.7 is also supported by Azure Functions. |
| 14 | +
|
| 15 | +[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)] |
| 16 | + |
| 17 | +[!INCLUDE [cloud-shell-try-it.md](../../../includes/cloud-shell-try-it.md)] |
| 18 | + |
| 19 | +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")] |
| 26 | + |
| 27 | +[!INCLUDE [cli-script-clean-up](../../../includes/cli-script-clean-up.md)] |
| 28 | + |
| 29 | +## Script explanation |
| 30 | + |
| 31 | +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). |
0 commit comments