> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/external-data-storage.md).

# External data storage

{% hint style="info" %}
**File-based configuration**

You can add `_FILE` to individual variables to provide their configuration in a separate file. Refer to [Keeping sensitive data in separate files](/deploy/host-n8n/configure-n8n/basic-configuration.md#keeping-sensitive-data-in-separate-files) for more details.
{% endhint %}

Refer to [External storage](/deploy/host-n8n/configure-n8n/scaling/use-external-storage.md) for more information on using external storage for binary data and execution data.

| Variable                                   | Type    | Default | Description                                                                                                                                                                                                                                                                                     |
| ------------------------------------------ | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `N8N_EXTERNAL_STORAGE_S3_HOST`             | String  | -       | Host of the n8n bucket in S3-compatible external storage. For example, `s3.us-east-1.amazonaws.com`                                                                                                                                                                                             |
| `N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME`      | String  | -       | Name of the n8n bucket in S3-compatible external storage.                                                                                                                                                                                                                                       |
| `N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION`    | String  | -       | Region of the n8n bucket in S3-compatible external storage. For example, `us-east-1`                                                                                                                                                                                                            |
| `N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY`       | String  | -       | Access key in S3-compatible external storage                                                                                                                                                                                                                                                    |
| `N8N_EXTERNAL_STORAGE_S3_ACCESS_SECRET`    | String  | -       | Access secret in S3-compatible external storage.                                                                                                                                                                                                                                                |
| `N8N_EXTERNAL_STORAGE_S3_AUTH_AUTO_DETECT` | Boolean | -       | Use automatic credential detection to authenticate S3 calls for external storage. This will ignore the access key and access secret and use the default [credential provider chain](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html#credchain). |

## Azure Blob Storage <a href="#azure-blob-storage" id="azure-blob-storage"></a>

{% hint style="info" %}
**Enterprise-tier feature**

You need an [Enterprise license key](/deploy/host-n8n/configure-n8n/manage-your-license.md) to store execution data or binary data in Azure Blob Storage.
{% endhint %}

To store execution data in Azure Blob Storage, set `N8N_EXECUTION_DATA_STORAGE_MODE` to `azure`. To store binary data in Azure Blob Storage, set `N8N_DEFAULT_BINARY_DATA_MODE` to `azure` (refer to [External storage](/deploy/host-n8n/configure-n8n/scaling/use-external-storage.md#storing-n8ns-binary-data-in-azure-blob-storage)). A single container can hold both. Configure the variables below; `N8N_EXTERNAL_STORAGE_AZURE_CONTAINER_NAME` is always required.

For authentication, choose one of these three options. n8n checks them in this order:

1. **Connection string**: set `N8N_EXTERNAL_STORAGE_AZURE_CONNECTION_STRING`. This takes precedence over the other options, so n8n ignores the account name, key, and auto-detect when you set it. It's the simplest option and works well for local testing with Azurite.
2. **Auto-detect**: set `N8N_EXTERNAL_STORAGE_AZURE_ACCOUNT_NAME` and set `N8N_EXTERNAL_STORAGE_AZURE_AUTH_AUTO_DETECT` to `true`. n8n authenticates through Azure's `DefaultAzureCredential` chain (managed identity, environment, or Azure CLI), so no key lives in your n8n configuration. Best for production on Azure.
3. **Account name and key**: set `N8N_EXTERNAL_STORAGE_AZURE_ACCOUNT_NAME` and `N8N_EXTERNAL_STORAGE_AZURE_ACCOUNT_KEY`.

Set `N8N_EXTERNAL_STORAGE_AZURE_ENDPOINT` only if you use a custom endpoint, such as Azurite or a sovereign cloud.

| Variable                                       | Type    | Default | Description                                                                                                                                              |
| ---------------------------------------------- | ------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `N8N_EXTERNAL_STORAGE_AZURE_CONNECTION_STRING` | String  | -       | Connection string for Azure Blob Storage. Takes precedence over the account name and key when set.                                                       |
| `N8N_EXTERNAL_STORAGE_AZURE_ACCOUNT_NAME`      | String  | -       | Storage account name. Use with an account key or managed identity.                                                                                       |
| `N8N_EXTERNAL_STORAGE_AZURE_ACCOUNT_KEY`       | String  | -       | Storage account key. Use with the account name.                                                                                                          |
| `N8N_EXTERNAL_STORAGE_AZURE_CONTAINER_NAME`    | String  | -       | Name of the blob container to store execution data and/or binary data in. Required for Azure Blob Storage.                                               |
| `N8N_EXTERNAL_STORAGE_AZURE_ENDPOINT`          | String  | -       | Custom blob endpoint, for example for Azurite or sovereign clouds.                                                                                       |
| `N8N_EXTERNAL_STORAGE_AZURE_AUTH_AUTO_DETECT`  | Boolean | `false` | Authenticate via `DefaultAzureCredential` (managed identity, environment, or Azure CLI) instead of an account key. Ignores the account key when enabled. |
