Configure Azure Blob Storage as the Mattermost file store¶
Mattermost can store user uploads – attachments, profile images, plugin assets, emoji, compliance exports – in an Azure Storage account. This guide walks an administrator through the steps to provision the Azure side and point a Mattermost server at it via the System Console.
Prerequisites¶
An Azure subscription where you can create resources, with Storage Account Contributor or higher on the target resource group.
Either the Azure portal, or the Azure CLI (
az) installed and signed in withaz login. Both are documented below.A Mattermost deployment (v11.x or later) with System Console access for a System Admin account.
If you plan to migrate existing files from another backend, take a backup of the current storage location (S3 bucket, local disk, etc.) before changing the configuration. Switching the file driver does not migrate existing files automatically.
Step 1: Create a storage account¶
Pick a globally unique name for the storage account (3-24 characters, lowercase letters and numbers only). The name becomes part of the public DNS host <account>.blob.core.windows.net, so customers usually pick something like acmemattermost or mattermost<env>.
Azure portal
Go to Storage accounts > Create.
Choose the subscription and resource group. Create a new resource group if needed.
Enter the storage account name and region.
Performance: Standard. Redundancy: Locally-redundant storage (LRS) for a single-region deployment, or Geo-redundant storage (GRS) for cross-region durability.
On the Advanced tab, set Minimum TLS version to
1.2and leave Allow Blob anonymous access disabled. Mattermost serves files through its own authenticated API and the container does not need to be public.Select Review + create.
Azure CLI
az group create \
--name mm-prod-files \
--location eastus
az storage account create \
--name acmemattermost \
--resource-group mm-prod-files \
--location eastus \
--sku Standard_LRS \
--kind StorageV2 \
--min-tls-version TLS1_2 \
--allow-blob-public-access false
Step 2: Create a container¶
All Mattermost uploads land in a single container. The container name must be lowercase and may contain letters, numbers, and hyphens (3-63 characters).
Azure portal
Open the storage account, then Containers > + Container.
Name it (for example,
mattermost).Public access level: Private (no anonymous access).
Azure CLI
az storage container create \
--name mattermost \
--account-name acmemattermost \
--auth-mode login
Step 4: Configure Mattermost¶
Sign in as a System Admin and open System Console > Environment > File Storage.
File storage system: select Azure Blob Storage. The Azure-specific fields appear and the S3/local fields are hidden.
Azure Storage account: the storage account name from step 1 (for example,
acmemattermost).Azure container: the container name from step 2 (for example,
mattermost).Azure path prefix: optional. Set this if you want Mattermost to write under a sub-path inside the container, for example
prod/. Leave empty to use the container root.Azure Storage account key: paste the shared key from step 3.
Azure endpoint: leave empty for the production Azure commercial cloud. Set this only if you need a non-default host, for example
azurite:10000for an Azurite emulator or a reverse-proxyhost[:port]in front of Blob Storage.Enable secure Azure Blob Storage connections: keep this enabled (the default). Only disable it when pointing at a local emulator without TLS.
Azure request timeout (milliseconds): default is
30000(30 seconds). Increase only if your network needs more time for large objects.
Select Test Connection. Mattermost issues a no-op write/read/delete against the configured container using the credentials submitted in the form. A green Connection was successful message confirms the credentials, container name, and endpoint all work. A red error message includes the underlying reason – common ones are listed in Troubleshooting.
Once the test succeeds, select Save.
Note
Sovereign clouds (Azure Government, Azure China) use account-style hosts that Mattermost selects automatically when the Azure endpoint field is left empty. They are not configured through the endpoint override.
Warning
Restart required. The Mattermost server caches the file storage backend at startup and does not re-create it when the file storage configuration changes. After saving, restart every Mattermost server in the deployment (systemctl restart mattermost, recycle the container, or roll the deployment in your cluster) for the new driver to take effect. Test Connection works before the restart because it builds a temporary backend from the submitted form values.
Note
Switching the file driver does not migrate existing files. If you are moving an existing deployment from local disk or S3, copy the contents into the Azure container first (for example with azcopy) before changing the driver. Files uploaded before the switch will not be reachable once the driver changes.
Step 5: Verify¶
After the restart, reload the System Console or any channel.
Upload an attachment in any channel. A small image is a good test, because Mattermost stores three blobs for an image (original, preview, thumbnail), which exercises the upload path more thoroughly than a plain file.
The post should render the attachment and preview as usual.
In the Azure portal, open the container and confirm new blobs appeared under the path
<YYYYMMDD>/teams/<team>/channels/<channel>/users/<user>/<file_id>/(the same layout the local-disk and S3 backends use). For an image you will see<name>.<ext>,<name>_preview.<ext>, and<name>_thumb.<ext>.
(Optional) Configure the export backend¶
Compliance and data exports can be stored separately from regular file uploads. The File Storage (Exports) section directly below File Storage in the System Console mirrors the fields above and accepts the same Azure credentials. Customers typically point exports at a different container (or a different account) so the export retention policy can differ from regular uploads.
See Enable dedicated export filestore target for the full list of ExportAzure* keys.
Troubleshooting¶
Symptom |
Likely cause |
|---|---|
|
Wrong account name or shared key. Confirm both in the Access keys blade of the Azure portal. |
|
Container name is wrong or was created under a different storage account. |
|
Azure endpoint is set to a host that isn’t reachable, or Enable secure Azure Blob Storage connections is disabled when the destination requires TLS. |
Test Connection succeeds but uploads in channels fail |
Check System Console > Reporting > Server Logs for the Azure error returned by the SDK. The most common cause is a forgotten server restart after Save. |
Files uploaded before the switch are no longer visible |
The existing files are still on the previous backend. Copy them into the Azure container with |
Reference¶
Each Azure setting is documented in detail in Environment configuration settings:
File storage system (
FileSettings.DriverName)Azure Storage account (
FileSettings.AzureStorageAccount)Azure container (
FileSettings.AzureContainer)Azure path prefix (
FileSettings.AzurePathPrefix)Azure Storage account key (
FileSettings.AzureAccessKey)Azure endpoint (
FileSettings.AzureEndpoint)Enable secure Azure Blob Storage connections (
FileSettings.AzureSSL)Azure request timeout (
FileSettings.AzureRequestTimeoutMilliseconds)