Azure AppService File system

It is important to monitor your disk utilization as your application grows. If the disk quota is reached, it can have adverse effects to your application. To understand what happens you should know about the different types of files and what happens when you scale out.

Types of files

There are 3 main types of files.

Persisted files

They are rooted in D:\home or %HOME% and at /home on linux.

You can rely on these files staying there until you change them. They follow a structure which is described here.

The available space is related to your App Service Plan, see pricing.

Temporary files

A number of common Windows locations are using temporary storage on the local machine. For instance

%APPDATA% points to something like D:\local\AppData.

%TMP% goes to D:\local\Temp.

For Free, Shared and Consumption (Functions) sites, there is a 500MB limit for all these locations together (i.e. not per-folder).

For Standard and higher plans the limit depends on the selected SKU.

Machine level files

The Web App accesses many standard windows locations like %ProgramFiles% and %windir%. These files are read only.

Scaling out

home directory

The home directory is shared through all instances and if you write content in here, all instances will get the change.

Quote from source 2:

The home directory contains an app's content, and application code can write to it. If an app runs on multiple instances, the home directory is shared among all instances so that all instances see the same directory. So, for example, if an app saves uploaded files to the home directory, those files are immediately available to all instances.

Internally, the way this works is that they are stored in Azure Storage instead of living on the local file system.

Temporary files

The temporary files are different, files from instance A aren't available on instance B.

Machine level read-only files

These files can't be changed by users (read-only hehe). That's why we can ignore those files in a scale out scenario.

Sources

  1. https://github.com/projectkudu/kudu/wiki/Understanding-the-Azure-App-Service-file-system
  2. https://docs.microsoft.com/en-us/azure/app-service/operating-system-functionality#file-access