Access Azure Storage (preview) as a network share from a container in App Service

This guide shows how to attach Azure Storage Files as a network share to a windows container in App Service. Only Azure Files Shares and Premium Files Shares are supported. Benefits include secured content, content portability, access to multiple apps, and multiple transferring methods.

Note

Azure Storage in App Service is in preview and not supported for production scenarios.

This guide shows how to attach Azure Storage to a Linux container App Service. Benefits include secured content, content portability, persistent storage, access to multiple apps, and multiple transferring methods.

Note

Azure Storage in App Service is in preview for App Service on Linux and Web App for Containers. It's not supported for production scenarios.

Prerequisites

Note

Azure Files is non-default storage and billed separately, not included with the web app. It doesn't support using Firewall configuration due to infrastructure limitations.

Limitations

  • Azure Storage in App Service is currently not supported for bring your own code scenarios (non-containerized Windows apps).
  • Azure Storage in App Service doesn't support using the Storage Firewall configuration because of infrastructure limitations.
  • Azure Storage with App Service lets you specify up to five mount points per app.
  • Azure Storage mounted to an app is not accessible through App Service FTP/FTPs endpoints. Use Azure Storage Explorer.
  • Azure Storage in App Service supports mounting Azure Files containers (Read / Write) and Azure Blob containers (Read Only)
  • Azure Storage in App Service lets you specify up to five mount points per app.
  • Azure Storage mounted to an app is not accessible through App Service FTP/FTPs endpoints. Use Azure Storage Explorer.

Once you've created your Azure Storage account, file share and directory, you can now configure your app with Azure Storage.

To mount an Azure Files Share to a directory in your App Service app, you use the az webapp config storage-account add command. Storage Type must be AzureFiles.

az webapp config storage-account add --resource-group <group-name> --name <app-name> --custom-id <custom-id> --storage-type AzureFiles --share-name <share-name> --account-name <storage-account-name> --access-key "<access-key>" --mount-path <mount-path-directory of form c:<directory name> >

You should do this for any other directories you want to be linked to an Azure Files share.

Once you've created your Azure Storage account, file share and directory, you can now configure your app with Azure Storage.

To mount a storage account to a directory in your App Service app, you use the az webapp config storage-account add command. Storage Type can be AzureBlob or AzureFiles. AzureFiles is used in this example. The mount path setting corresponds to the folder inside the container that you want to mount to Azure Storage. Setting it to '/' mounts the entire container to Azure Storage.

Caution

The directory specified as the mount path in your web app should be empty. Any content stored in this directory will be deleted when an external mount is added. If you are migrating files for an existing app, make a backup of your app and its content before you begin.

az webapp config storage-account add --resource-group <group-name> --name <app-name> --custom-id <custom-id> --storage-type AzureFiles --share-name <share-name> --account-name <storage-account-name> --access-key "<access-key>" --mount-path <mount-path-directory>

You should do this for any other directories you want to be linked to a storage account.

Verify linked storage

Once the share is linked to the app, you can verify this by running the following command:

az webapp config storage-account list --resource-group <resource-group> --name <app-name>

Next steps