Serve content from Azure Storage in App Service on Linux

This guide shows how to serve static content in App Service on Linux by using Azure Storage. Benefits include secured content, content portability, access to multiple apps, and multiple transferring methods.


  • An existing web app (App Service on Linux or Web App for Containers).
  • Azure CLI (2.0.46 or later).

Create Azure Storage


Azure Storage is non-default storage and billed separately, not included with the web app.

Create an Azure Azure storage account.

#Create Storage Account
az storage account create --name <storage_account_name> --resource-group myResourceGroup

#Create Storage Container
az storage container create --name <storage_container_name> --account-name <storage_account_name>

Upload files to Azure Storage

To upload a local directory to the storage account, you use the az storage blob upload-batch command like the following example:

az storage blob upload-batch -d <full_path_to_local_directory> --account-name <storage_account_name> --account-key "<access_key>" -s <source_location_name>


Linking an existing directory in a web app to a storage account will delete the directory contents. If you are migrating files for an existing app, make a backup of your app and its content before you begin.

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. You use AzureBlob for this container.

az webapp config storage-account add --resource-group <group_name> --name <app_name> --custom-id <custom_id> --storage-type AzureBlob --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.


Once a storage container is linked to a web app, you can verify this by running the following command:

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

Use custom storage in Docker Compose

Azure Storage can be mounted with multi-container apps using the custom-id. To view the custom-id name, run az webapp config storage-account list --name <app_name> --resource-group <resource_group>.

In your docker-compose.yml file, map the volumes option to custom-id. For example:

  image: wordpress:latest
  - <custom-id>:<path_in_container>

Next steps