In this video, I demonstrate how you can use Azure Blob Storage directly from AL with only a few lines of code, check it out:

In this video, Erik walks through how to use Azure Blob Storage (ABS) from within Business Central using the built-in AL framework. With database storage at a premium in the Microsoft cloud, Azure Blob Storage offers a cheap, fast alternative for storing binary data, JSON, XML, images, and more. Erik demonstrates the full lifecycle: authenticating, creating containers, uploading blobs, listing them, and reading their content — all from AL code.
Why Azure Blob Storage?
With database space being at a premium in Microsoft’s cloud, if you have a lot of binary data that you need to store, you should consider storing it elsewhere. Azure Blob Storage is an excellent option — it’s cheap, it’s fast (super fast, actually), and Microsoft has added a comprehensive framework to work with it directly from AL as part of the System Application.
All the relevant objects in the framework are prefixed with ABS, making them easy to discover through IntelliSense.
Setting Up in Azure
Before writing any code, you need a Storage Account in Azure. A storage account is a generic storage resource that can hold many things — virtual machine disk images, application data, blobs, and more. Within a storage account, you work with containers, which are essentially folders for your blobs.
Erik created a fresh, empty storage account called erikyoutube in the Azure portal before starting the demo.
The Complete Code
Here’s the full working example that Erik builds throughout the video. It’s implemented as a page extension on the Customer List, with the logic running in the OnOpenPage trigger:
pageextension 50100 CustomerListExt extends "Customer List"
{
trigger OnOpenPage();
var
response: Codeunit "ABS Operation Response";
containers: Record "ABS Container";
content: Record "ABS Container Content";
Txt: Text;
begin
Authorization := StorageServiceAuthorization.CreateSharedKey('uKox8/1MnfUXZgjIBggIe9DCVK4zmTXawt4O2vvwFYdJ+19+TDUmvopnA+70x8M0JhLl/8rFk/w3+AStpCrPag==');
ContainerClient.Initialize('erikyoutube', Authorization);
response := ContainerClient.CreateContainer('youtube');
response := ContainerClient.ListContainers(containers);
if response.IsSuccessful() then begin
if containers.findset() then
repeat
message('%1', containers.Name);
until containers.next() = 0;
end else
message('ABS Error: %1', response.GetError());
BlobClient.Initialize('erikyoutube', 'youtube', Authorization);
response := BlobClient.PutBlobBlockBlobText('BCBlob2', 'This is the content of our blobloblob');
if not Response.IsSuccessful() then
message('PutBlobBlobBlob %1', response.GetError());
response := BlobClient.ListBlobs(content);
if response.IsSuccessful() then
if content.findset() then
repeat
message('%1', content.Name);
BlobClient.GetBlobAsText(content.Name, Txt);
Message('%1', Txt);
until content.next() = 0;
end;
var
ContainerClient: Codeunit "ABS Container Client";
BlobClient: Codeunit "ABS Blob Client";
StorageServiceAuthorization: Codeunit "Storage Service Authorization";
Authorization: Interface "Storage Service Authorization";
}
Let’s break this down step by step.
Step 1: Authentication
The first thing you need to do is authenticate against your Azure storage account. The framework provides the "Storage Service Authorization" codeunit (note: it’s not prefixed with ABS because it’s used across multiple storage services, not just blob storage).
Authorization := StorageServiceAuthorization.CreateSharedKey('uKox8/1Mnf...');
You can get the shared key from the Azure portal by navigating to your storage account and clicking Show Keys. The CreateSharedKey function returns a "Storage Service Authorization" interface, which you’ll pass to the clients. There’s also an option to use a Shared Access Signature (SAS) instead of a key.
Step 2: Working with Containers
To manage containers, you use the "ABS Container Client" codeunit. Initialize it with your storage account name and the authorization interface:
ContainerClient.Initialize('erikyoutube', Authorization);
Once initialized, creating a container is a single line:
response := ContainerClient.CreateContainer('youtube');
Every operation returns an "ABS Operation Response" codeunit that you can check for success or failure. After running this, Erik refreshed the Azure portal and confirmed the new youtube container appeared.
Listing Containers
To list all containers in the storage account, use the ListContainers method, which populates a temporary "ABS Container" record:
response := ContainerClient.ListContainers(containers);
if response.IsSuccessful() then begin
if containers.findset() then
repeat
message('%1', containers.Name);
until containers.next() = 0;
end else
message('ABS Error: %1', response.GetError());
The "ABS Container" table is always temporary by default, so you don’t need to worry about postfixing it with temporary.
Step 3: Working with Blobs
To work with blobs inside a container, you need a separate client: the "ABS Blob Client" codeunit. The key difference from the container client is that the blob client’s Initialize method takes three parameters — the storage account, the container name, and the authorization:
BlobClient.Initialize('erikyoutube', 'youtube', Authorization);
Uploading a Blob
The blob client offers several methods for uploading data: PutBlobBlockBlobText, PutBlobBlockBlobStream, AppendBlock, and more. For simple text content:
response := BlobClient.PutBlobBlockBlobText('BCBlob2', 'This is the content of our blobloblob');
if not Response.IsSuccessful() then
message('PutBlobBlobBlob %1', response.GetError());
Erik noted with amusement that the method name PutBlobBlockBlobText reads almost like a tongue twister — “like an alcohol test for drivers.”
Listing Blobs
To list all blobs in a container, use the ListBlobs method, which populates a temporary "ABS Container Content" record:
response := BlobClient.ListBlobs(content);
if response.IsSuccessful() then
if content.findset() then
repeat
message('%1', content.Name);
until content.next() = 0;
The content record exposes several useful fields including Name, "Content Length", "Content Type", "Creation Time", "Full Name", "Last Modified", and URI.
Reading Blob Content
Once you have a blob’s name, you can retrieve its content as text, as a stream, or trigger a file download:
GetBlobAsText— retrieves the blob content into a text variableGetBlobAsStream— retrieves the blob content into a streamGetBlobAsFile— triggers a download in the browser
BlobClient.GetBlobAsText(content.Name, Txt);
Message('%1', Txt);
Running this successfully displayed “This is the content of our blobloblob” — confirming the round-trip of storing and retrieving data.
A Note on Debugging
Erik pointed out an annoying quirk when debugging: the "Storage Service Authorization" codeunit contains a try function called TryGetConstantHeaders that causes pseudo-breakpoints in the debugger. These aren’t real errors — the code completes successfully — but the debugger pauses on them, which can be frustrating during development.
Summary
The Azure Blob Storage framework in Business Central is straightforward and well-organized. Here’s the workflow at a glance:
- Authenticate — Create authorization using a shared key or shared access signature via the
"Storage Service Authorization"codeunit - Manage containers — Use
"ABS Container Client"to create, list, and delete containers - Manage blobs — Use
"ABS Blob Client"to upload, list, read, and delete blobs within a container - Check responses — Every operation returns an
"ABS Operation Response"that lets you verify success and retrieve error details
Remember that blobs aren’t limited to text — they can hold JSON, XML, images, or any binary data. Azure Blob Storage is cheap and remarkably fast, making it an excellent option when you need to offload binary data from your Business Central database.