Edit

Store document attachments in external file storage

Business Central lets you store document attachments, such as PDFs, images, and scanned documents, outside the Business Central database. For example, in external file storage such as Microsoft Azure or SharePoint. By offloading attachments to a connected external storage service, you can significantly reduce your database size and avoid reaching storage limits. You can access attachments in Business Central, but the files are in your external storage account.

Keeping attachments in external storage can help you:

  • Stay within capacity limits. Each Business Central tenant has a limited database capacity. For example, 80 GB by default for production and sandbox environments, plus per-license extra storage. Offloading attachments helps keep your database within these limits, preventing the need to purchase extra capacity.
  • Improve performance and backups. A smaller database can improve overall system performance and reduce backup and restoration times.
  • Use inexpensive storage. External cloud storage such as Azure Blob Storage or SharePoint is typically more cost-effective for large file storage and can provide other features like sharing, content management, and long-term archiving.

Supported external storage providers

Out of the box, Business Central supports Azure cloud storage and Microsoft 365 services for external attachments. You can connect to Azure Blob Storage, Azure File Share, or SharePoint document libraries. The External File Storage framework is extensible, so partners or developers can add other storage providers (for example, SFTP or OneDrive) via extension if needed.

Important

You're responsible for your data management. When you enable external storage for attachments, files are no longer stored in the Business Central database. Instead, they reside in your external storage. This means Microsoft doesn't back up or manage those files as part of your Business Central environment. You, or your system administrator, are responsible for setting up appropriate backups and access control on the external storage. If a file is deleted or becomes unavailable in external storage, you can no longer access it from Business Central.

Set up an external file storage account

Before you can offload attachments, you must create one or more external file accounts in Business Central for the storage services you plan to use. An external file account stores the connection details, such as credentials and endpoints, for your Azure or SharePoint storage. You can set up multiple external file accounts. For example, one for Azure Blob Storage and another for SharePoint.

Register an app for SharePoint storage

Before you add a SharePoint storage account, register an app in Microsoft Entra ID and grant it permissions for the connector mode and authentication type that you use. The app registration permissions depend on whether the account uses the default Microsoft Graph API or the legacy SharePoint REST API. Grant only the permissions needed for the sites that Business Central accesses.

Connector mode Authentication type Least-privileged permission for full connector functionality Tenant-wide alternative
Microsoft Graph (default) Client Secret or Certificate Microsoft Graph application permission Sites.Selected and a write role granted for each site that the connector accesses Microsoft Graph application permission Sites.ReadWrite.All
Legacy SharePoint REST API Certificate SharePoint application permission Sites.Selected and a write role granted for each site that the connector accesses SharePoint application permission Sites.ReadWrite.All
Legacy SharePoint REST API Client Secret SharePoint delegated permission AllSites.Write; this is a tenant-wide scope, but access is also limited by the signed-in user's SharePoint permissions None; AllSites.Write is the minimum tenant-wide scope

The connector requires write access because it can upload, copy, move, and delete files and folders. It doesn't require permission to administer sites or manage permissions.

The connector first resolves the SharePoint site and then its default document library. These operations require site-level access. Therefore, the supported minimum is the Sites.Selected scope with a role grant on each site that the account uses. The connector doesn't support Lists.SelectedOperations.Selected, ListItems.SelectedOperations.Selected, or Files.SelectedOperations.Selected as alternatives.

Sites.Selected grants no access by itself. A SharePoint administrator must also grant the app the write role on every site that the connector accesses. The administrator can create the site-specific grants by using Microsoft Graph PowerShell, Microsoft 365 CLI, or Microsoft Graph. The app or administrator that creates these grants needs separate permission to manage site permissions; the connector app doesn't need that elevated permission.

The connector resolves the site and its default document library before accessing files and folders. Therefore, use the site-level Sites.Selected permission rather than narrower list-, folder-, or file-level selected permissions.

For legacy SharePoint REST API accounts, site-scoped folder creation requires Business Central 28.1 or later. In Business Central 28.0 and earlier, folder creation requests context information from the tenant root site, so the app must also be granted access to the root site.

Learn more in Overview of Selected Permissions in OneDrive and SharePoint and Understanding Resource Specific Consent for Microsoft Graph and SharePoint Online.

  1. Select Search (Alt+Q) in the upper-right corner, enter External File Accounts, and choose the related link.

  2. Choose the Add a file account action to start a setup guide that helps you enter details for your external storage connection.

  3. Select the type of storage you want to connect (for example, Azure Blob Storage, Azure File Share, or SharePoint), and then choose Next.

  4. Enter the required connection details. The details depend on the storage type you selected.

    • Azure Blob Storage account: Enter an Account Name, which is a friendly name for use in Business Central, and the Storage Account Name of your Azure storage account. Select the Authorization Type, either a Shared Access Signature (SAS) token or a shared account key. Paste the SAS token or access key in the Secret field. Specify the Container Name where you store attachments in your blob storage account.
    • Azure File Share account: Enter an Account Name and the Storage Account Name. Choose the authentication method (SAS token or key) and provide the Secret value. Enter the File Share Name for the Azure Files share where you store attachments.
    • SharePoint storage account: Enter an Account Name for Business Central, and then provide the Tenant ID, Client ID, and authentication credentials for the Microsoft Entra app registration that has access to your SharePoint site. Specify the SharePoint Name, which is the domain or site name, and a Base Relative Folder Path where you want to store attachments. For example, enter the document library and folder path within the site.

    Tip

    The base folder path should start from the site root, such as Shared Documents/Attachments, in a SharePoint document library URL.

  5. Choose Next.

  6. Review the information, and choose Finish. Business Central saves the new external file account. You can repeat these steps to add multiple storage accounts if needed. For example, if you want to connect to both an Azure storage and a SharePoint library. The External File Accounts page lists all configured accounts.

At this point, you're connected to your external storage. Next, enable document attachment features to use one of your external file accounts to store attachments.

Enable external storage for document attachments

After you set up a file account for external storage, the next step is to assign the document attachments scenario to it. This step tells Business Central to offload attachments to the storage instead of the database.

  1. Select Search (Alt+Q) in the upper-right corner, enter File Scenario Assignment, and choose the related link.

  2. Choose the Assign scenarios action. The Assign scenarios to account page opens, listing available file accounts and their assigned scenarios. Locate the file account you would like to assign the scenario to, and choose OK.

  3. To assign a document attachments scenario to storage account, select the file account line, and then choose Assign Scenarios or Edit. Select the Document Attachments - External Storage file scenario. Confirm that you want to configure storage for document attachments.

  4. After you confirm, the External Storage Setup page opens. Set up how to offload attachments:

    • Turn on the Enabled toggle for the Document Attachments scenario. This setting confirms that Business Central offloads attachments to the specified storage. Business Central displays a warning that using external storage is at your own risk and that you're responsible for managing and backing up the files. Read the warning, and then choose Yes to proceed. The Document Attachments scenario is now active.
    • In the Root folder field, choose a folder in your external storage where you store attachments for this Business Central environment. You can only select an existing container/folder. Business Central automatically organizes subfolders in this root using a structured hierarchy of environment, company, table, and so on, to group files by their source record type. For example, it stores attachments for records in the Sales Header table (sales orders, and so on) in a Sales Header folder in your storage.
    • To specify whether to delete an attachment record in your external storage when someone deletes the record in Business Central, turn on the Delete External File on Attachment Delete toggle. If you disable this option, deleting an attachment in Business Central removes the link in Business Central, but the file remains in external storage until you manually remove it.
  5. Review your settings, and then choose Close to complete the scenario setup. The Document Attachments feature is now linked to your external storage account. From this point on, new attachments you add to records in Business Central are stored in the external location instead of the Business Central database.

    Note

    Only attachments people add after you enable this feature are kept in your external storage. To move existing attachments from your Business Central database to external storage, go to the File Scenarios or External Storage Setup pages and use the Storage Sync action. You can specify the direction you want to move files, and the operation to do so.

    You can also use the action if you need to stop using external storage and revert to storing attachments in the Business Central database. The action can move all files back into the database from the external storage. Afterward, you can turn off external storage.

Work with attachments after you offload them

Document attachment features don't change for users after you enable external file storage. You still manage attachments using the Attachments FactBox on records, or the Document Attachments page, as usual. The difference is behind the scenes. When you attach a file, Business Central uploads it to your external storage. When you view or download an attachment, Business Central retrieves it from external storage automatically.

Attach a file to a record when external storage is enabled

You attach files to records using the Attachments tab on the FactBox, or the Attachments action on the Lines FastTab for line-level attachments in the same way as with standard attachments. For example, on the Sales Order page, you can drag and drop a file onto the Attachments FactBox, or choose the Attach file action and select a file from your device. The file appears in the Documents section of the FactBox, showing its name and size.

  • If you configure external storage for attachments, Business Central immediately transfers the file to the external file account you set up.
  • Business Central ensures that each file name is unique in the external storage by appending a unique ID to the file name. The ID prevents different records with the same original file name from overwriting each other in a flat storage container. For example, it gives two different invoices named invoice.pdf distinct names in the external storage. The attachment’s title in Business Central remains the original file name without the unique ID, but the file in external storage has the ID.

View or download an attached file

To open or save an attachment, select it from the Attachments FactBox or Document Attachments page, and choose Open or Download. Business Central gets the file from external storage automatically. Supported PDF and image files open in preview mode, so you can review them without downloading them first. If you want to save a copy, use the Download action in the previewer. Other file types download to your device, where you can open them.

Supported image formats include JPEG, JPG, PNG, BMP, SVG, WEBP, ICO, GIF, and AVIF. GIF and AVIF formats include support for animated files. On Safari, TIFF and TIF images are also supported.

Note

If the file doesn't exist in the external storage, for example, because you deleted it, an error displays because the link is broken in Business Central.

Delete an attached file

To remove an attachment, use the Delete action on the record from the FactBox or Document Attachments list. Business Central deletes the attachment record from its database. If you enabled the option to also delete external files, Business Central sends a request to remove the file from the external storage as well. If that option is off, the file remains in external storage but is no longer linked to a record in Business Central.

Move or copy records

If you use features like Copy Company or environment backup/restore, keep in mind that attachments you store externally aren't automatically copied. The attachment records (metadata) might be copied, but they still point to files in the original external storage location unless you migrate those files manually. To do so, go to the External Storage Setup page, and run the Migrate Files action. This report migrates all document attachments from a previous environment or company folder to the current environment/company folder in external storage.

Note

You can browse and manage your external file storage from within Business Central. On the External File Accounts page, select your storage account, and choose the Storage Browser action to open the External Storage Browser page. This page displays the folders and files in your connected storage. It shows all files in a selected Azure blob container, and allows you to upload, download, or delete files. You can also create new folders in the external storage. This page can be useful for verifying that files are saving as expected, or for manually managing external documents.

Work with Business Central
Administration

Find free e-learning modules for Business Central here