Skip to main content

Actions

The ballerinax/azure.storage.files package connects to Microsoft Azure Files. It exposes the following clients:

ClientPurpose
ClientOperations within one share, bound at initialization.
AdminClientAccount-level share management and service configuration.

For event-driven integration, see the Trigger Reference.


Client​

Operates on a single file share, bound at initialization, and on the directories and files within it.

Configuration​

Both clients take a ClientConfiguration. Credentials come from the Setup Guide.

FieldTypeDefaultDescription
authAuthConfigRequiredThe authentication configuration: one credential-artifact record (an account key, a bare SAS token, a full SAS URL, a connection string, or a Microsoft Entra ID identity).
retryConfigRetryConfig()Retry behavior for service requests; omit for the service defaults.
transportConfigTransportConfig()HTTP transport settings (proxy, connection pool, TLS); omit for the defaults.

AuthConfig is a union of the credential records below. Each member has a unique required field or field combination, so the right member is selected by the fields you supply. The only exception is the pair DefaultEntraIdConfig and ManagedIdentityConfig, which would otherwise share the same field shape; these two, and only these two, carry a kind discriminator field. The other Entra ID records have no kind field.

SharedKeyConfig, Shared Key authentication using one of the storage account's access keys:

FieldTypeDefaultDescription
accountNamestringRequiredThe storage account name, used to sign requests and to derive the service URL.
accountKeystringRequiredA base64-encoded access key of the storage account.
serviceUrlstring()The file service endpoint URL, including the scheme. Omit to use the default https://{accountName}.file.core.windows.net.

SasConfig, Shared Access Signature (SAS) authentication with a bare SAS token:

FieldTypeDefaultDescription
accountNamestringRequiredThe name of the storage account the token belongs to (determines the service URL).
sasTokenstringRequiredA SAS token scoped to the required resources and permissions.

SasUrlConfig, SAS authentication with a full SAS URL, which carries the service URL and the SAS token in one string, as issued by the Azure portal:

FieldTypeDefaultDescription
sasUrlstringRequiredA full file-service SAS URL, including the scheme and the SAS query string (e.g. https://{account}.file.core.windows.net/?sv=...&sig=...).

ConnectionStringConfig, connection-string authentication. The connection string carries the account name, the credential (an account key or a SAS token), and the service endpoints:

FieldTypeDefaultDescription
connectionStringstringRequiredAn Azure Storage connection string, as issued by the Azure portal, the Azure CLI, or infrastructure tooling.

EntraIdConfig is itself a union of five records, one per Microsoft Entra ID credential kind. The identity must hold the Storage File Data Privileged Reader or Storage File Data Privileged Contributor role.

DefaultEntraIdConfig, authentication through the default credential chain. The chain tries the environment, a managed identity, and developer sign-ins (Azure CLI, IDE accounts) in turn, so one configuration works both locally and when deployed:

FieldTypeDefaultDescription
kindDEFAULT_AZURE_CREDENTIALRequiredSelects the default credential chain (the value "default").
accountNamestringRequiredThe storage account name (determines the service URL unless serviceUrl overrides it).
serviceUrlstring()The file service endpoint URL, including the scheme. Omit to use the default https://{accountName}.file.core.windows.net.

ManagedIdentityConfig, authentication as an Azure managed identity, for workloads running on Azure compute (VMs, App Service, AKS, Functions):

FieldTypeDefaultDescription
kindMANAGED_IDENTITYRequiredSelects the managed-identity credential (the value "managed-identity").
accountNamestringRequiredThe storage account name (determines the service URL unless serviceUrl overrides it).
clientIdstring()The client id of a user-assigned managed identity; omit to use the system-assigned identity.
serviceUrlstring()The file service endpoint URL, including the scheme. Omit to use the default https://{accountName}.file.core.windows.net.

ClientSecretConfig, authentication as a service principal with a client secret:

FieldTypeDefaultDescription
accountNamestringRequiredThe storage account name (determines the service URL unless serviceUrl overrides it).
tenantIdstringRequiredThe Entra ID tenant (directory) id.
clientIdstringRequiredThe application (client) id of the service principal.
clientSecretstringRequiredThe client secret of the service principal.
serviceUrlstring()The file service endpoint URL, including the scheme. Omit to use the default https://{accountName}.file.core.windows.net.

ClientCertificateConfig, authentication as a service principal with a client certificate:

FieldTypeDefaultDescription
accountNamestringRequiredThe storage account name (determines the service URL unless serviceUrl overrides it).
tenantIdstringRequiredThe Entra ID tenant (directory) id.
clientIdstringRequiredThe application (client) id of the service principal.
certificatePathstringRequiredThe path to the certificate file (PEM, or PFX when certificatePassword is set).
certificatePasswordstring()The password protecting the certificate file, when it has one.
serviceUrlstring()The file service endpoint URL, including the scheme. Omit to use the default https://{accountName}.file.core.windows.net.

WorkloadIdentityConfig, workload-identity authentication, for Kubernetes workloads federated with Entra ID:

FieldTypeDefaultDescription
accountNamestringRequiredThe storage account name (determines the service URL unless serviceUrl overrides it).
tenantIdstringRequiredThe Entra ID tenant (directory) id.
clientIdstringRequiredThe application (client) id federated with the workload.
tokenFilePathstringRequiredThe path to the file holding the federated service-account token.
serviceUrlstring()The file service endpoint URL, including the scheme. Omit to use the default https://{accountName}.file.core.windows.net.

RetryConfig, retry behavior for service requests:

FieldTypeDefaultDescription
retryPolicyTypeRetryPolicyTypeEXPONENTIALHow the delay between tries grows (EXPONENTIAL or FIXED_INTERVAL).
maxTriesint4The maximum number of tries (the first attempt plus retries).
tryTimeoutSecondsdecimal60The timeout applied to each individual try, in seconds.
retryDelaySecondsdecimal4The base delay between tries, in seconds.
maxRetryDelaySecondsdecimal120The upper bound on the delay between tries, in seconds.
secondaryHostUrlstring()A secondary endpoint to retry reads against (geo-redundant accounts).

TransportConfig, HTTP transport settings, proxying, connection pooling, and TLS:

FieldTypeDefaultDescription
proxyProxyConfig()Route traffic through this proxy.
connectionPoolConnectionPoolConfig{}Connection-pool tuning.
secureSocketSecureSocket()Custom TLS settings (trust and key material, verification).

ProxyConfig, routes the connector's traffic through a proxy server:

FieldTypeDefaultDescription
proxyTypeProxyTypeRequiredThe proxy protocol (HTTP, SOCKS4, or SOCKS5).
hoststringRequiredThe proxy host name or IP address.
portintRequiredThe proxy port.
usernamestring()The user name, when the proxy requires authentication.
passwordstring()The password, when the proxy requires authentication.
nonProxyHostsstring[][]Hosts reached directly, bypassing the proxy.

ConnectionPoolConfig, tunes the connector's HTTP connection pool:

FieldTypeDefaultDescription
maxConnectionsint50The maximum number of concurrent connections.
idleTimeoutSecondsdecimal60How long an idle connection is kept before being closed, in seconds.
connectTimeoutSecondsdecimal10The timeout for establishing a connection, in seconds.
readTimeoutSecondsdecimal60The timeout for reading a response, in seconds.

SecureSocket, custom TLS settings for the connection to the service:

FieldTypeDefaultDescription
certcrypto:TrustStore|string()The trust material for verifying the server: a PKCS12 or JKS truststore, or the path to a PEM certificate file. Omit to trust the platform's default certificate authorities.
'keycrypto:KeyStore|CertKey()The client's own identity for mutual TLS: a PKCS12 or JKS keystore, or a certificate and private key pair. Omit when the server does not request a client certificate.
tlsVersionsstring[]()The TLS versions offered during the handshake (e.g. TLSv1.3, TLSv1.2). Omit to use the platform defaults.
ciphersstring[]()The cipher suites offered during the handshake. Omit to use the platform defaults.
verifyHostNamebooleantrueVerify that the server certificate matches the host being called. Disabling this removes protection against man-in-the-middle attacks, so it is meant for testing only.
shareSessionbooleantrueAllow TLS sessions to be reused across connections.
validateRevocationbooleanfalseCheck the server certificate against revocation information: a stapled OCSP response when the server sends one, otherwise an OCSP or CRL fetch. Requires cert to be set.
serverNamestring()The SNI (Server Name Indication) host name presented during the handshake; omit to use the host being called.
handshakeTimeoutSecondsdecimal()The TLS handshake timeout, in seconds.
sessionTimeoutSecondsdecimal()How long a TLS session stays reusable, in seconds.

CertKey, a client certificate and private key pair, as files:

FieldTypeDefaultDescription
certFilestringRequiredThe path to the certificate file.
keyFilestringRequiredThe path to the private key file.
keyPasswordstring()The password protecting the private key, when it has one.

Initializing the client​

The client binds to one share at initialization. Client.init makes no call to Azure, so binding to a nonexistent share succeeds and the first operation on it fails with a NotFoundError; check up front with AdminClient.hasShare.

import ballerinax/azure.storage.files;

configurable string accountName = ?;
configurable string accountKey = ?;

files:Client fileShare = check new ("reports", auth = {accountName, accountKey});

With a Microsoft Entra ID service principal instead of an account key:

import ballerinax/azure.storage.files;

configurable string accountName = ?;
configurable string tenantId = ?;
configurable string clientId = ?;
configurable string clientSecret = ?;

files:Client fileShare = check new ("reports", auth = {accountName, tenantId, clientId, clientSecret});

The fields present in the auth value select the credential record, so a Config.toml entry can switch auth modes without a code change:

# The fields present select the union member:
[myapp.filesConfig]
auth = {accountName = "myacct", accountKey = "..."} # SharedKeyConfig
# auth = {accountName = "myacct", sasToken = "sv=..."} # SasConfig
# auth = {sasUrl = "https://myacct.file.core.windows.net/?sv=..."}# SasUrlConfig
# auth = {connectionString = "..."} # ConnectionStringConfig
# auth = {kind = "default", accountName = "myacct"} # DefaultEntraIdConfig
# auth = {kind = "managed-identity", accountName = "myacct"} # ManagedIdentityConfig
# auth = {accountName = "myacct", tenantId = "...", clientId = "...", clientSecret = "..."} # ClientSecretConfig
# auth = {accountName = "myacct", tenantId = "...", clientId = "...", certificatePath = "/path/cert.pem"} # ClientCertificateConfig
# auth = {accountName = "myacct", tenantId = "...", clientId = "...", tokenFilePath = "/path/token"} # WorkloadIdentityConfig

Operations​

Share operations​

Operations on the bound share itself.

getShareProperties

Gets the properties of the bound share (quota, tier, protocols). This is a share-level operation, so it needs account-level credentials at runtime; a share- or file-scoped SAS fails.

Returns: ShareProperties|Error

Sample code:

files:ShareProperties properties = check fileShare->getShareProperties();

Sample response:

{
quotaInGb: 100,
accessTier: "TransactionOptimized",
eTag: "\"0x8DDA1B2C3D4E5F6\"",
lastModified: [1770307200, 0.0],
metadata: {department: "finance"}
}
setShareMetadata

Replaces the metadata of the bound share. The supplied map replaces the complete metadata set, so any entry omitted from it is cleared. This is a share-level operation, so it needs account-level credentials at runtime; a share- or file-scoped SAS fails.

Parameters:

NameTypeRequiredDescription
metadatamap<string>YesThe complete metadata set (replaces all existing metadata).

Returns: Error?

Sample code:

check fileShare->setShareMetadata({department: "finance", year: "2026"});
getShareUsage

Gets the approximate amount of data stored on the bound share, in bytes. This is a share-level operation, so it needs account-level credentials at runtime; a share- or file-scoped SAS fails.

Returns: int|Error

Sample code:

int usageBytes = check fileShare->getShareUsage();

Sample response:

1073741824

Directory operations​

Directory paths are slash-delimited, share-relative strings such as "/2026/q1"; the leading slash is optional.

createDirectory

Creates a directory in the bound share.

Parameters:

NameTypeRequiredDescription
directoryPathstringYesThe share-relative path of the directory to create.
optionsDirectoryCreateOptionsNoOptional creation options (metadata). See DirectoryCreateOptions.

Returns: Error?

Sample code:

check fileShare->createDirectory("/2026/q1");
deleteDirectory

Deletes a directory from the bound share; the directory must be empty, otherwise the delete fails with a ConflictError.

Parameters:

NameTypeRequiredDescription
directoryPathstringYesThe share-relative path of the directory to delete.

Returns: Error?

Sample code:

check fileShare->deleteDirectory("/2026/q1/drafts");
hasDirectory

Checks whether a directory exists in the bound share. It returns false only when Azure confirms the directory is absent (a confirmed 404); an Error means the check itself failed.

Parameters:

NameTypeRequiredDescription
directoryPathstringYesThe share-relative path of the directory.

Returns: boolean|Error

Sample code:

boolean directoryExists = check fileShare->hasDirectory("/2026/q1");

Sample response:

true
getDirectoryProperties

Gets the properties of a directory.

Parameters:

NameTypeRequiredDescription
directoryPathstringYesThe share-relative path of the directory.

Returns: DirectoryProperties|Error

Sample code:

files:DirectoryProperties properties = check fileShare->getDirectoryProperties("/2026/q1");

Sample response:

{
eTag: "\"0x8DDA1B2C3D4E5F6\"",
lastModified: [1770307200, 0.0],
isServerEncrypted: true
}
setDirectoryMetadata

Replaces the metadata of a directory. The supplied map replaces the complete metadata set, so any entry omitted from it is cleared.

Parameters:

NameTypeRequiredDescription
directoryPathstringYesThe share-relative path of the directory.
metadatamap<string>YesThe complete metadata set (replaces all existing metadata).

Returns: Error?

Sample code:

check fileShare->setDirectoryMetadata("/2026/q1", {reviewed: "true"});
list

Lists the entries (files and subdirectories) under a directory as one lazy stream. By default the listing is non-recursive and Entry.eTag/Entry.lastModified are absent; set ListOptions.recursive to descend into subdirectories and ListOptions.includeExtendedInfo to populate the ETag and timestamp fields.

Parameters:

NameTypeRequiredDescription
directoryPathstringYesThe share-relative path of the directory to list.
optionsListOptionsNoOptional listing options (prefix, recursion, extended info). See ListOptions.

Returns: stream<Entry, Error?>|Error

Sample code:

stream<files:Entry, files:Error?> entries = check fileShare->list("/2026/q1", {recursive: true});
check entries.forEach(function(files:Entry entry) {
// process entry.path
});

Sample response:

{
path: "/2026/q1/report.pdf",
name: "report.pdf",
isDirectory: false,
sizeBytes: 524288,
id: "13835093239654252544"
}
renameDirectory

Renames or moves a directory within the bound share, together with its entire contents; a rename never crosses shares. It is a move, not a copy: the source path no longer exists afterward. An existing file at the destination is overwritten only with RenameOptions.replaceIfExists; an existing directory at the destination always fails the operation.

Parameters:

NameTypeRequiredDescription
sourcePathstringYesThe current share-relative path of the directory.
destinationPathstringYesThe new share-relative path.
optionsRenameOptionsNoOptional rename options (overwrite, metadata). See RenameOptions.

Returns: Error?

Sample code:

check fileShare->renameDirectory("/2026/q1-draft", "/2026/q1");

File operations​

File paths are slash-delimited, share-relative strings such as "/2026/q1/report.pdf"; the leading slash is optional.

createFile

Creates an empty file, pre-allocated at a fixed size.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file to create.
sizeInBytesintYesThe size of the file, in bytes.
optionsCreateOptionsNoOptional creation options (headers, metadata). See CreateOptions.

Returns: Error?

Sample code:

check fileShare->createFile("/2026/q1/report.pdf", 524288);
deleteFile

Deletes a file from the bound share.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file to delete.

Returns: Error?

Sample code:

check fileShare->deleteFile("/2026/q1/report-old.pdf");
hasFile

Checks whether a file exists in the bound share. It returns false only when Azure confirms the file is absent (a confirmed 404); an Error means the check itself failed.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.

Returns: boolean|Error

Sample code:

boolean fileExists = check fileShare->hasFile("/2026/q1/report.pdf");

Sample response:

true
getFileProperties

Gets the properties of a file, including its metadata (there is no separate metadata getter; read metadata from the metadata field of the result).

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.

Returns: FileProperties|Error

Sample code:

files:FileProperties properties = check fileShare->getFileProperties("/2026/q1/report.pdf");

Sample response:

{
eTag: "\"0x8DDA1B2C3D4E5F6\"",
lastModified: [1770307200, 0.0],
contentLength: 524288,
contentType: "application/pdf",
metadata: {reviewed: "true"},
isServerEncrypted: true
}
setFileMetadata

Replaces the metadata of a file. The supplied map replaces the complete metadata set, so any entry omitted from it is cleared; read the current metadata from getFileProperties().metadata.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.
metadatamap<string>YesThe complete metadata set (replaces all existing metadata).

Returns: Error?

Sample code:

check fileShare->setFileMetadata("/2026/q1/report.pdf", {reviewed: "true"});
setContentHeaders

Sets the content headers of a file, such as Content-Type and Cache-Control. The supplied record replaces the complete header set, so any header omitted from it is cleared; metadata is untouched.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.
headersContentHeadersYesThe full set of content headers the file should carry. See ContentHeaders.

Returns: Error?

Sample code:

check fileShare->setContentHeaders("/2026/q1/report.pdf", {
contentType: "application/pdf",
cacheControl: "max-age=3600"
});
renameFile

Renames or moves a file within the bound share; a rename never crosses shares. It is a move, not a copy: the source path no longer exists afterward. An existing destination file is overwritten only when RenameOptions.replaceIfExists is set, and an existing directory at the destination always fails the operation.

Parameters:

NameTypeRequiredDescription
sourcePathstringYesThe current share-relative path of the file.
destinationPathstringYesThe new share-relative path.
optionsRenameOptionsNoOptional rename options (overwrite, metadata). See RenameOptions.

Returns: Error?

Sample code:

check fileShare->renameFile("/2026/q1/report-draft.pdf", "/2026/q1/report.pdf", {replaceIfExists: true});

Transfer operations​

uploadFromFile and download move data between a local file on disk and the share; the other operations work in memory or over streams. Transfer paths are full paths including the file name on both sides.

uploadFromFile

Uploads a local file to the bound share (disk to share).

Parameters:

NameTypeRequiredDescription
sourcePathstringYesThe path of the local file to upload, including the file name.
destinationPathstringYesThe share-relative path the file is written to, including the file name.
optionsUploadOptionsNoOptional upload options (headers, metadata). See UploadOptions.

Returns: Error?

Sample code:

check fileShare->uploadFromFile("./reports/q1.pdf", "/2026/q1/report.pdf");
upload

Uploads in-memory content to the bound share. A byte[] is written as-is, and an xml value as its textual form. A string is written verbatim as raw UTF-8 text, never JSON-quoted; call toJsonString() first to store a JSON encoding of a string. A record (which includes any map of anydata members), a record array, or any other json value is serialized per the format resolved from UploadContentOptions.fileFormat when set, else from the destination path's extension (.json, .xml, .csv): a record becomes a JSON or an XML document (never CSV), a record array becomes CSV rows headed by the union of the records' field names in first-seen order (nil or absent members as empty cells), and any other json value (an array, a scalar, or nil) becomes a JSON document. An unresolvable format, a record directed to CSV, a record array directed to a non-CSV format, or a non-mapping json value directed to a non-JSON format fails with a client-side Error.

Parameters:

NameTypeRequiredDescription
contentUploadContentYesThe content to upload: byte[]|string|json|xml|record |record [].
destinationPathstringYesThe share-relative path the content is written to, including the file name.
optionsUploadContentOptionsNoEvery UploadOptions field plus fileFormat (JSON, XML, or CSV), the record serialization format override.

Returns: Error?

Sample code:

Metrics metrics = {revenue: 1250000, growth: 0.12};
check fileShare->upload(metrics, "/2026/q1/metrics.json");
uploadFromStream

Uploads a byte stream to the bound share. contentLength is required up front, and must not be negative, because Azure Files pre-allocates the file, so a stream of unknown length cannot be uploaded. A length mismatch or a failure of the source stream is a client-side Error, and every failure closes the source stream.

Parameters:

NameTypeRequiredDescription
contentstream<byte[], error?>YesThe byte stream to upload.
contentLengthintYesThe total length of the content, in bytes.
destinationPathstringYesThe share-relative path the content is written to, including the file name.
optionsUploadOptionsNoOptional upload options (headers, metadata). See UploadOptions.

Returns: Error?

Sample code:

stream<byte[], io:Error?> fileStream = check io:fileReadBlocksAsStream("./reports/q1.pdf");
check fileShare->uploadFromStream(fileStream, 524288, "/2026/q1/report.pdf");
download

Downloads a file to a local path (share to disk). The download fails with a client-side Error when a local file already exists at destinationPath.

Parameters:

NameTypeRequiredDescription
sourcePathstringYesThe share-relative path of the file to download, including the file name.
destinationPathstringYesThe local path to write the downloaded file to (must not exist).
optionsDownloadOptionsNoOptional download options (range, snapshot). See DownloadOptions.

Returns: Error?

Sample code:

check fileShare->download("/2026/q1/report.pdf", "./reports/q1.pdf");
getFile

Retrieves the file's content in the form the target type selects: byte[] (raw, materialized), string (UTF-8 text; invalid UTF-8 fails client-side), json, xml, record {}/record {}[], which includes any map of anydata members and arrays of them (bound per the resolved format), stream<byte[], error?> (a lazy byte stream), or stream<record {}, error?> (lazy CSV rows, where a row that fails to bind surfaces as that pull's error entry). Record-shaped targets resolve their format from options.fileFormat when set, else the path's extension (.json, .xml, .csv): a single record binds from JSON or XML (never CSV), a record array from a JSON array or CSV rows (never XML), and an unresolvable format fails with a client-side Error. CSV content binds to record array and record stream targets only; for positional or headerless rows, read the content as string or byte[] and parse it with the data.csv module. Binding is strict.

Parameters:

NameTypeRequiredDescription
pathstringYesThe source share-relative path.
optionsGetFileOptionsNoOptional retrieval options (range, snapshot, record binding format). See GetFileOptions.
targetTypetypedesc<RetrievableType>NoThe expected return type, used for automatic data binding; inferred from the assignment target. Accepts byte[]|string|json|xml|record |record []|stream<byte[], error?>|stream<record , error?>.

Returns: targetType|Error — the content in the requested form, or an Error on a failed retrieval or a data binding failure.

Sample code:

byte[] raw = check fileShare->getFile("/2026/q1/report.pdf");
Person[] people = check fileShare->getFile("/2026/q1/people.csv");
stream<byte[], error?> chunks = check fileShare->getFile("/2026/q1/large.bin");

Copy operations​

Server-side copy is non-blocking: it returns a copyId you can poll with checkCopyStatus and cancel with abortCopy.

copyFile

Copies a file within the bound share. The copy is asynchronous; inspect the returned CopyInfo.copyStatus for its state.

Parameters:

NameTypeRequiredDescription
sourcePathstringYesThe source share-relative path.
destinationPathstringYesThe destination share-relative path.
optionsCopyOptionsNoOptional copy options (metadata). See CopyOptions.

Returns: CopyInfo|Error

Sample code:

files:CopyInfo copy = check fileShare->copyFile("/2026/q1/report.pdf", "/archive/2026-q1-report.pdf");

Sample response:

{
copyId: "1c556d19-8b45-42d1-a4b5-6a1e73923d20",
copyStatus: "pending",
eTag: "\"0x8DDA1B2C3D4E5F6\"",
lastModified: [1770307200, 0.0]
}
copyFileFromUrl

Copies a file from an external URL into the bound share. A cross-account file source or any blob-container source must carry its own authorization in the URL (typically a SAS token); a same-account file source needs none.

Parameters:

NameTypeRequiredDescription
sourceUrlstringYesThe URL of the source file.
destinationPathstringYesThe destination share-relative path.
optionsCopyOptionsNoOptional copy options (metadata). See CopyOptions.

Returns: CopyInfo|Error

Sample code:

files:CopyInfo copy = check fileShare->copyFileFromUrl(
"https://otheracct.file.core.windows.net/backups/2026/q1/report.pdf?sv=2025-05-05&sig=...",
"/2026/q1/report.pdf"
);

Sample response:

{
copyId: "8d1f3a52-6c07-4e4b-9f21-b3a8c5d4e6f7",
copyStatus: "pending",
eTag: "\"0x8DDA1B2C3D4E5F7\"",
lastModified: [1770307260, 0.0]
}
checkCopyStatus

Checks the state of the most recent copy operation that targeted a file; it returns () when the file was never the destination of a copy. Call again to observe a pending copy's progress.

Parameters:

NameTypeRequiredDescription
pathstringYesThe destination share-relative path of the copy.

Returns: CopyStatusInfo?|Error

Sample code:

files:CopyStatusInfo? status = check fileShare->checkCopyStatus("/archive/2026-q1-report.pdf");

Sample response:

{
copyId: "1c556d19-8b45-42d1-a4b5-6a1e73923d20",
copyStatus: "success",
copyProgress: {copiedBytes: 524288, totalBytes: 524288}
}
abortCopy

Aborts a pending asynchronous copy operation.

Parameters:

NameTypeRequiredDescription
pathstringYesThe destination share-relative path of the copy.
copyIdstringYesThe identifier of the copy to abort (from CopyInfo.copyId).

Returns: Error?

Sample code:

check fileShare->abortCopy("/archive/2026-q1-report.pdf", "1c556d19-8b45-42d1-a4b5-6a1e73923d20");

Range operations​

A file is pre-allocated; these operations fill, clear, and inspect specific byte ranges, which suits sparse or random-write workloads.

uploadRange

Writes a range of bytes into a file at a given offset. A single range write is capped at 4 MiB by the service with no internal chunking (the transfer operations chunk internally); larger content is rejected.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.
offsetintYesThe zero-based byte offset at which to begin writing.
contentbyte[]YesThe bytes to write (at most 4 MiB).

Returns: Error?

Sample code:

byte[] content = check io:fileReadBytes("./chunks/part-000.bin");
check fileShare->uploadRange("/2026/q1/data.bin", 0, content);
clearRange

Clears a range of bytes in a file. The service deallocates space in 512-byte units, so a cleared span smaller than that is zeroed but may still appear in listRanges.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.
offsetintYesThe zero-based byte offset at which to begin clearing.
lengthintYesThe number of bytes to clear.

Returns: Error?

Sample code:

check fileShare->clearRange("/2026/q1/data.bin", 1048576, 524288);
listRanges

Lists the valid (written) byte ranges of a file; both bounds of each returned Range are inclusive.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.
optionsRangeListOptionsNoOptional range-listing options. See RangeListOptions.

Returns: Range[]|Error

Sample code:

files:Range[] ranges = check fileShare->listRanges("/2026/q1/data.bin");

Sample response:

[{startByte: 0, endByte: 4194303}]

Share snapshot operations​

Point-in-time, read-only copies of the share. Snapshot contents are read through the regular read operations by passing the snapshot's id as the snapshotId of DownloadOptions or ListOptions.

createShareSnapshot

Creates a point-in-time, read-only snapshot of the bound share. Like the other snapshot operations, it needs account-level credentials; a share- or file-scoped SAS fails.

Parameters:

NameTypeRequiredDescription
metadatamap<string>NoOptional metadata to set on the snapshot; when absent, the share's metadata is copied to the snapshot.

Returns: ShareSnapshotInfo|Error

Sample code:

files:ShareSnapshotInfo snapshot = check fileShare->createShareSnapshot();

Sample response:

{
snapshotId: "2026-08-06T09:15:22.0000000Z",
eTag: "\"0x8DDA1B2C3D4E5F6\"",
lastModified: [1770307200, 0.0]
}
listShareSnapshots

Lists the snapshots of the bound share. This operation needs account-level credentials; a share- or file-scoped SAS fails.

Returns: ShareSnapshotInfo[]|Error

Sample code:

files:ShareSnapshotInfo[] snapshots = check fileShare->listShareSnapshots();

Sample response:

[
{
snapshotId: "2026-08-06T09:15:22.0000000Z",
eTag: "\"0x8DDA1B2C3D4E5F6\"",
lastModified: [1770307200, 0.0]
}
]
deleteShareSnapshot

Deletes one snapshot of the bound share. This operation needs account-level credentials; a share- or file-scoped SAS fails.

Parameters:

NameTypeRequiredDescription
snapshotIdstringYesThe identifier of the snapshot to delete.

Returns: Error?

Sample code:

check fileShare->deleteShareSnapshot("2026-08-06T09:15:22.0000000Z");
listRangesDiff

Lists how a file's byte ranges changed since a share snapshot: the ranges written and the ranges cleared.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file.
previousSnapshotIdstringYesThe identifier of the baseline snapshot to diff against.
optionsRangeListOptionsNoOptional range-listing options. See RangeListOptions.

Returns: RangeDiff|Error

Sample code:

files:RangeDiff diff = check fileShare->listRangesDiff("/2026/q1/data.bin", "2026-08-06T09:15:22.0000000Z");

Sample response:

{
ranges: [{startByte: 0, endByte: 511}],
clearRanges: []
}

SAS generation​

These are ordinary methods, not remote functions: they sign locally without a service call, so invoke them with . rather than ->. generateShareSas and generateSas require the client to hold a SharedKeyConfig (or a connection string carrying an account key); the user-delegation variants sign with a UserDelegationKey obtained from AdminClient.getUserDelegationKey.

generateShareSas

Generates a SAS (Shared Access Signature) token scoped to the bound share; the client must hold shared key credentials.

Parameters:

NameTypeRequiredDescription
valuesShareSasSignatureValuesYesWhat the SAS grants: validity window and permissions, or a stored policy reference. See ShareSasSignatureValues.

Returns: string|Error

Sample code:

string sasToken = check fileShare.generateShareSas({
expiryTime: time:utcAddSeconds(time:utcNow(), 3600),
permissions: {read: true, list: true}
});

Sample response:

"sv=2025-05-05&sr=s&sp=rl&se=2026-08-06T10%3A00%3A00Z&sig=nJd7..."
generateSas

Generates a SAS (Shared Access Signature) token scoped to a single file; the client must hold shared key credentials.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file the SAS grants access to.
valuesFileSasSignatureValuesYesWhat the SAS grants: validity window and permissions, or a stored policy reference. See FileSasSignatureValues.

Returns: string|Error

Sample code:

string sasToken = check fileShare.generateSas("/2026/q1/report.pdf", {
expiryTime: time:utcAddSeconds(time:utcNow(), 3600),
permissions: {read: true}
});

Sample response:

"sv=2025-05-05&sr=f&sp=r&se=2026-08-06T10%3A00%3A00Z&sig=Xk2p..."
generateShareUserDelegationSas

Generates a user-delegation SAS token scoped to the bound share, signed with an Entra ID user-delegation key instead of the account key. A user-delegation SAS is valid at most 7 days, and stored access policies do not apply to it: the generator rejects an identifier and requires an explicit expiryTime and permissions.

Parameters:

NameTypeRequiredDescription
valuesShareSasSignatureValuesYesWhat the SAS grants: validity window and permissions, both required here. See ShareSasSignatureValues.
keyUserDelegationKeyYesThe user-delegation key to sign with, from AdminClient.getUserDelegationKey.

Returns: string|Error

Sample code:

// An Entra ID-authenticated AdminClient mints the delegation key.
files:AdminClient admin = check new (auth = {accountName, tenantId, clientId, clientSecret});
files:UserDelegationKey key = check admin->getUserDelegationKey(
time:utcNow(), time:utcAddSeconds(time:utcNow(), 86400));
string sasToken = check fileShare.generateShareUserDelegationSas({
expiryTime: time:utcAddSeconds(time:utcNow(), 3600),
permissions: {read: true, list: true}
}, key);

Sample response:

"sv=2025-05-05&sr=s&sp=rl&se=2026-08-06T10%3A00%3A00Z&skoid=3d1e2f3a-...&sig=Qm9r..."
generateUserDelegationSas

Generates a user-delegation SAS token scoped to a single file, signed with an Entra ID user-delegation key instead of the account key. A user-delegation SAS is valid at most 7 days, and stored access policies do not apply to it: the generator rejects an identifier and requires an explicit expiryTime and permissions.

Parameters:

NameTypeRequiredDescription
pathstringYesThe share-relative path of the file the SAS grants access to.
valuesFileSasSignatureValuesYesWhat the SAS grants: validity window and permissions, both required here. See FileSasSignatureValues.
keyUserDelegationKeyYesThe user-delegation key to sign with, from AdminClient.getUserDelegationKey.

Returns: string|Error

Sample code:

// An Entra ID-authenticated AdminClient mints the delegation key.
files:AdminClient admin = check new (auth = {accountName, tenantId, clientId, clientSecret});
files:UserDelegationKey key = check admin->getUserDelegationKey(
time:utcNow(), time:utcAddSeconds(time:utcNow(), 86400));
string sasToken = check fileShare.generateUserDelegationSas("/2026/q1/report.pdf", {
expiryTime: time:utcAddSeconds(time:utcNow(), 3600),
permissions: {read: true}
}, key);

Sample response:

"sv=2025-05-05&sr=f&sp=r&se=2026-08-06T10%3A00%3A00Z&skoid=3d1e2f3a-...&sig=Ttw4..."

AdminClient​

Account-level administration: share lifecycle and existence checks, file-service configuration, and account SAS.

Configuration​

The AdminClient takes the same ClientConfiguration as the Client; see the Client configuration tables above.

Under Microsoft Entra ID credentials, the AdminClient operations authorize against the storage account's management permissions (the Microsoft.Storage/storageAccounts/fileServices/shares/ actions, carried by roles such as Contributor); the Storage File Data Privileged roles alone do not cover them. The one exception is getUserDelegationKey, which requires the Storage File Delegator role instead. See the Setup Guide for the role split.

Initializing the client​

import ballerinax/azure.storage.files;

configurable string accountName = ?;
configurable string accountKey = ?;

files:AdminClient admin = check new (auth = {accountName, accountKey});

Operations​

Share management​

hasShare

Checks whether a share exists in the storage account. It returns false only when Azure confirms the share is absent (a confirmed 404); an Error means the check itself failed.

Parameters:

NameTypeRequiredDescription
shareNamestringYesThe name of the share to check.

Returns: boolean|Error

Sample code:

boolean shareExists = check admin->hasShare("reports");

Sample response:

true
listShares

Lists the shares in the storage account, with optional filtering and optional inclusion of metadata, snapshots, and soft-deleted shares.

Parameters:

NameTypeRequiredDescription
optionsShareListOptionsNoOptional filtering and listing options. See ShareListOptions.

Returns: ShareInfo[]|Error

Sample code:

files:ShareInfo[] shares = check admin->listShares({includeMetadata: true});

Sample response:

[
{
name: "reports",
properties: {
quotaInGb: 100,
accessTier: "TransactionOptimized",
eTag: "\"0x8DDA1B2C3D4E5F6\"",
lastModified: [1770307200, 0.0]
},
metadata: {department: "finance"}
}
]
createShare

Creates a new share in the storage account.

Parameters:

NameTypeRequiredDescription
shareNamestringYesThe name of the share to create.
optionsShareCreateOptionsNoOptional creation options (quota, tier, protocols, metadata). See ShareCreateOptions.

Returns: Error?

Sample code:

check admin->createShare("reports", {quotaInGb: 100});
deleteShare

Deletes a share from the storage account. Under the account's soft-delete retention policy (the default for new accounts) the delete is soft, and the share is restorable with undeleteShare.

Parameters:

NameTypeRequiredDescription
shareNamestringYesThe name of the share to delete.
optionsShareDeleteOptionsNoOptional deletion options (snapshot handling, lease id). See ShareDeleteOptions.

Returns: Error?

Sample code:

check admin->deleteShare("reports-2024");
undeleteShare

Restores a soft-deleted share. Find restorable shares and their versions with listShares({includeDeleted: true}).

Parameters:

NameTypeRequiredDescription
shareNamestringYesThe name of the soft-deleted share to restore.
versionstringYesThe version of the soft-deleted share (from ShareInfo.version).

Returns: Error?

Sample code:

check admin->undeleteShare("reports-2024", "01D9E9CE4B0316F0");

Service configuration​

getServiceProperties

Reads the account's file-service configuration (metrics and CORS rules).

Returns: ServiceProperties|Error

Sample code:

files:ServiceProperties properties = check admin->getServiceProperties();

Sample response:

{
hourMetrics: {enabled: true, version: "1.0", includeApis: true, retentionDays: 7},
minuteMetrics: {enabled: false},
cors: []
}
setServiceProperties

Updates the account's file-service configuration; the record replaces the whole configuration.

Parameters:

NameTypeRequiredDescription
propertiesServicePropertiesYesThe complete file-service configuration to apply. See ServiceProperties.

Returns: Error?

Sample code:

check admin->setServiceProperties({
hourMetrics: {enabled: true, includeApis: true, retentionDays: 7}
});

User delegation and account SAS​

generateAccountSas is an ordinary method that signs locally without a service call; invoke it with . rather than ->.

getUserDelegationKey

Gets a user-delegation key for signing user-delegation SAS tokens; the key is valid at most 7 days. This operation works only on an Entra ID client whose identity holds the Storage File Delegator role.

Parameters:

NameTypeRequiredDescription
startTimetime:UtcYesThe start of the key's validity period.
expiryTimetime:UtcYesThe end of the key's validity period (at most 7 days out).

Returns: UserDelegationKey|Error

Sample code:

files:UserDelegationKey key = check admin->getUserDelegationKey(
time:utcNow(), time:utcAddSeconds(time:utcNow(), 86400));

Sample response:

{
signedObjectId: "3d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a",
signedTenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47",
signedStart: [1770307200, 0.0],
signedExpiry: [1770393600, 0.0],
signedService: "f",
signedVersion: "2025-05-05",
value: "aGVsbG8gd29ybGQ="
}
generateAccountSas

Generates an account-level SAS (Shared Access Signature) token; the client must hold shared key credentials.

Parameters:

NameTypeRequiredDescription
valuesAccountSasSignatureValuesYesWhat the SAS grants: validity window, permissions, and resource types. See AccountSasSignatureValues.

Returns: string|Error

Sample code:

string sasToken = check admin.generateAccountSas({
expiryTime: time:utcAddSeconds(time:utcNow(), 3600),
permissions: {read: true, list: true},
resourceTypes: {'service: true, container: true, 'object: true}
});

Sample response:

"sv=2025-05-05&ss=f&srt=sco&sp=rl&se=2026-08-06T10%3A00%3A00Z&sig=Bv3k..."

Supporting types​

The option, SAS, and result records used by the operations above, documented once.

ContentHeaders​

The standard content headers that can be set on a file.

FieldTypeDefaultDescription
contentTypestring()The MIME type of the content (e.g. application/pdf), served as Content-Type on downloads.
contentEncodingstring()Any encoding applied to the stored content (e.g. gzip).
contentLanguagestring()The natural language of the content (e.g. en-US).
contentDispositionstring()How receivers should present the content (e.g. attachment or inline).
cacheControlstring()Caching directives served with the file (e.g. max-age=3600, private).
contentMd5string()Base64-encoded MD5 of the content, for integrity verification.

ShareListOptions​

Options for AdminClient.listShares.

FieldTypeDefaultDescription
prefixstring()Return only shares whose name begins with this prefix.
includeMetadatabooleanfalseInclude each share's metadata in the results.
includeSnapshotsbooleanfalseInclude share snapshots in the results.
includeDeletedbooleanfalseInclude soft-deleted shares in the results.

ShareCreateOptions​

Options for AdminClient.createShare.

FieldTypeDefaultDescription
metadatamap<string>()User-defined metadata to set on the new share.
quotaInGbint()The provisioned capacity of the share, in GiB; when absent, the account kind's default quota applies.
accessTierShareAccessTier()The access tier for the share; when absent, the account kind's default tier applies (TRANSACTION_OPTIMIZED on pay-as-you-go accounts, PREMIUM on premium accounts).
enabledProtocolsShareProtocol[][SMB]The protocols to enable on the share (SMB and/or NFS).
rootSquashNfsRootSquash()The NFS root-squash setting (NFS shares only); when absent, NFS shares default to NO_ROOT_SQUASH.

ShareDeleteOptions​

Options for AdminClient.deleteShare.

FieldTypeDefaultDescription
deleteSnapshotsShareSnapshotsDeleteOption()How the share's snapshots are handled; when absent, only the share itself is deleted (the delete fails if snapshots exist).
snapshotIdstring()Delete a specific snapshot rather than the share itself.
leaseIdstring()The active lease id, required when the share is leased.

DirectoryCreateOptions​

Options for Client.createDirectory.

FieldTypeDefaultDescription
metadatamap<string>()User-defined metadata to set on the new directory.

ListOptions​

Options for Client.list.

FieldTypeDefaultDescription
prefixstring()Return only entries whose name begins with this prefix.
recursivebooleanfalseList entries in subdirectories as well.
pageSizeint5000The number of entries fetched per service round-trip, up to the service maximum of 5,000. Does not cap the total number of results.
includeExtendedInfobooleanfalseInclude the ETag and timestamps on each entry.
snapshotIdstring()List from the share snapshot with this id instead of the live share.

RenameOptions​

Options for Client.renameFile and Client.renameDirectory.

FieldTypeDefaultDescription
replaceIfExistsbooleanfalseIf a file already occupies the destination path, delete it and give its path to the renamed entry. A directory occupying the destination always fails the operation regardless of this flag.
metadatamap<string>()User-defined metadata to set on the renamed entry (replaces all existing metadata); when absent, the existing metadata is preserved.

CreateOptions​

Options for Client.createFile (creating an empty file of a given size).

FieldTypeDefaultDescription
contentHeadersContentHeaders()Content headers to set on the file, such as Content-Type and Cache-Control.
metadatamap<string>()User-defined metadata to set on the file.

UploadOptions​

Options for the upload operations (uploadFromFile and uploadFromStream; upload takes UploadContentOptions).

FieldTypeDefaultDescription
contentHeadersContentHeaders()Content headers to set on the file, such as Content-Type and Cache-Control.
metadatamap<string>()User-defined metadata to set on the file.

UploadContentOptions​

Options for upload: every UploadOptions field, plus the record serialization format override.

FieldTypeDefaultDescription
fileFormatFileFormat()The serialization format for json, record, and record array content: JSON, XML, or CSV. When absent, the format is inferred from the destination path's extension (.json, .xml, .csv).

DownloadOptions​

Options for download, included by getFile's GetFileOptions.

FieldTypeDefaultDescription
rangeRange()Download only this byte range instead of the whole file.
snapshotIdstring()Read from the share snapshot with this id instead of the live share.

GetFileOptions​

Options for getFile: every DownloadOptions field, plus the record binding format override.

FieldTypeDefaultDescription
fileFormatFileFormat()The binding format for record {} and record {}[] targets: JSON, XML, or CSV. When absent, the format is inferred from the path's extension (.json, .xml, .csv).

CopyOptions​

Options for Client.copyFile and Client.copyFileFromUrl.

FieldTypeDefaultDescription
metadatamap<string>()User-defined metadata to set on the destination; when absent, the metadata is copied from the source file.

RangeListOptions​

Options for Client.listRanges and Client.listRangesDiff.

FieldTypeDefaultDescription
rangeRange()Restrict the listing to this byte range.

ShareSasSignatureValues​

The inputs for generating a share-scoped SAS via Client.generateShareSas or Client.generateShareUserDelegationSas.

FieldTypeDefaultDescription
expiryTimetime:Utc()The end of the SAS validity period (UTC). May be omitted only when identifier references a stored access policy that carries an expiry.
permissionsShareSasPermissions()The permissions the SAS grants. May be omitted only when identifier references a stored access policy that carries permissions.
startTimetime:Utc()The start of the SAS validity period (UTC); omit for immediately valid.
protocolSasProtocol()The protocols a request presenting the SAS may use; omit to allow HTTPS and HTTP.
ipRangestring()An IP address or range the requests must come from (e.g. 168.1.5.60-168.1.5.70).
identifierstring()The identifier of a stored access policy on the share, as an alternative to spelling out expiry and permissions here. Not valid for the user delegation variants, which reject it.

Generation fails with an Error when neither identifier nor both expiryTime and permissions are supplied.

ShareSasPermissions​

The permissions granted by a share-scoped SAS. Every permission is off unless enabled.

FieldTypeDefaultDescription
readbooleanfalseRead file content, properties, and metadata.
createbooleanfalseCreate files and directories.
writebooleanfalseWrite file content, properties, and metadata.
deletebooleanfalseDelete files and directories.
listbooleanfalseList files and directories.

FileSasSignatureValues​

The inputs for generating a file-scoped SAS via Client.generateSas or Client.generateUserDelegationSas.

FieldTypeDefaultDescription
expiryTimetime:Utc()The end of the SAS validity period (UTC). May be omitted only when identifier references a stored access policy that carries an expiry.
permissionsFileSasPermissions()The permissions the SAS grants. May be omitted only when identifier references a stored access policy that carries permissions.
startTimetime:Utc()The start of the SAS validity period (UTC); omit for immediately valid.
protocolSasProtocol()The protocols a request presenting the SAS may use; omit to allow HTTPS and HTTP.
ipRangestring()An IP address or range the requests must come from (e.g. 168.1.5.60-168.1.5.70).
identifierstring()The identifier of a stored access policy on the share, as an alternative to spelling out expiry and permissions here. Not valid for the user delegation variants, which reject it.

Generation fails with an Error when neither identifier nor both expiryTime and permissions are supplied.

FileSasPermissions​

The permissions granted by a file-scoped SAS. Every permission is off unless enabled.

FieldTypeDefaultDescription
readbooleanfalseRead the file's content, properties, and metadata.
createbooleanfalseCreate the file.
writebooleanfalseWrite the file's content, properties, and metadata.
deletebooleanfalseDelete the file.

AccountSasSignatureValues​

The inputs for generating an account-level SAS via AdminClient.generateAccountSas.

FieldTypeDefaultDescription
expiryTimetime:UtcRequiredThe end of the SAS validity period (UTC).
permissionsAccountSasPermissionsRequiredThe permissions the SAS grants.
resourceTypesAccountSasResourceTypesRequiredThe resource types the SAS applies to.
startTimetime:Utc()The start of the SAS validity period (UTC); omit for immediately valid.
protocolSasProtocol()The protocols a request presenting the SAS may use; omit to allow HTTPS and HTTP.
ipRangestring()An IP address or range the requests must come from (e.g. 168.1.5.60-168.1.5.70).

AccountSasPermissions​

The permissions granted by an account-level SAS. Every permission is off unless enabled.

FieldTypeDefaultDescription
readbooleanfalseRead content, properties, and metadata, and list entries.
writebooleanfalseWrite content, properties, and metadata.
deletebooleanfalseDelete resources.
listbooleanfalseList shares and directory contents.
addbooleanfalseAdd content (append-style operations of other storage services).
createbooleanfalseCreate new resources.
updatebooleanfalseUpdate stored entities (of other storage services).
processbooleanfalseProcess stored messages (of other storage services).

AccountSasResourceTypes​

The resource types an account-level SAS applies to. Every type is off unless enabled.

FieldTypeDefaultDescription
'servicebooleanfalseService-level operations (e.g. list shares, service properties).
containerbooleanfalseContainer-level operations (the share level: share properties, metadata).
'objectbooleanfalseObject-level operations (files and directories).

Entry​

One entry returned by Client.list.

FieldTypeDescription
pathstringThe share-relative path of the entry, e.g. /dir1/dir2/file.ext.
namestringThe entry name (file or directory), without the directory component.
isDirectorybooleantrue if the entry is a directory, false if it is a file.
sizeBytesintThe file size in bytes; not present for directories.
idstringThe entry identifier.
eTagstringThe entity tag; present only when the listing requests extended info (ListOptions.includeExtendedInfo).
lastModifiedtime:UtcThe last-modified time (UTC); present only when the listing requests extended info.

ShareProperties​

Properties of a file share, as returned by Client.getShareProperties and inside ShareInfo.

FieldTypeDescription
quotaInGbintThe provisioned capacity of the share, in GiB.
accessTierShareAccessTierThe share's access tier. Shares on premium (FileStorage) accounts always report PREMIUM.
eTagstringThe entity tag for optimistic concurrency.
lastModifiedtime:UtcThe last-modified time (UTC).
metadatamap<string>User-defined metadata.
enabledProtocolsShareProtocol[]The enabled protocols (SMB and/or NFS).
rootSquashNfsRootSquashThe NFS root-squash setting (NFS shares only).
leaseStateLeaseStateWhere the lease stands in its lifecycle; present only while a lease exists.
leaseStatusLeaseStatusLOCKED while a lease is in force, UNLOCKED otherwise; present only while a lease exists.
leaseDurationLeaseDurationWhether the active lease is infinite or fixed-duration; present only while a lease exists.
provisionedIopsintProvisioned IOPS (premium shares only).
provisionedBandwidthMibpsintProvisioned bandwidth in MiB/s (premium shares only).

ShareInfo​

One share as returned by AdminClient.listShares.

FieldTypeDescription
namestringThe share name.
propertiesSharePropertiesThe share's properties.
metadatamap<string>User-defined metadata, when requested via ShareListOptions.includeMetadata.
snapshotIdstringThe snapshot identifier, present only for snapshot listings.
isDeletedbooleantrue when this entry is a soft-deleted share (requires includeDeleted).
versionstringThe share version; pass to AdminClient.undeleteShare to restore a deleted share.

DirectoryProperties​

Properties of a directory, as returned by Client.getDirectoryProperties.

FieldTypeDescription
eTagstringThe entity tag for optimistic concurrency.
lastModifiedtime:UtcThe last-modified time (UTC).
metadatamap<string>User-defined metadata.
isServerEncryptedbooleanWhether the service has encrypted the directory at rest.

FileProperties​

Properties of a file, as returned by Client.getFileProperties.

FieldTypeDescription
eTagstringThe entity tag for optimistic concurrency.
lastModifiedtime:UtcThe last-modified time (UTC).
contentLengthintThe size of the file in bytes.
contentTypestringThe MIME type of the content, served as Content-Type on downloads. application/octet-stream when no content type was ever set.
contentEncodingstringThe encoding applied to the stored content (e.g. gzip).
contentDispositionstringHow receivers should present the content (e.g. attachment or inline).
cacheControlstringCaching directives served with the file (e.g. max-age=3600, private).
contentMd5stringBase64-encoded MD5 of the content, for integrity verification.
metadatamap<string>User-defined metadata.
isServerEncryptedbooleanWhether the service has encrypted the file at rest (server-side encryption, covering the file data and its metadata).
leaseStateLeaseStateWhere the lease stands in its lifecycle; present only while a lease exists.
leaseStatusLeaseStatusLOCKED while a lease is in force, UNLOCKED otherwise; present only while a lease exists.
leaseDurationLeaseDurationWhether the active lease is infinite or fixed-duration; present only while a lease exists.
copyStatusCopyStatusThe status of the most recent copy operation, if any.
copyIdstringThe identifier of the most recent copy operation, if any.
copyProgressCopyProgressProgress of the most recent copy operation, if any.

CopyInfo​

The result of starting a copy operation. Copies are asynchronous.

FieldTypeDescription
copyIdstringThe copy operation identifier; pass to Client.abortCopy to cancel a pending copy.
copyStatusCopyStatusThe copy status at the moment the copy started, PENDING while the copy is still in progress.
eTagstringThe entity tag of the destination after the copy started.
lastModifiedtime:UtcThe last-modified time of the destination (UTC).

CopyStatusInfo​

The state of the most recent copy operation that targeted a file, as returned by Client.checkCopyStatus.

FieldTypeDescription
copyIdstringThe identifier of the copy operation; pass to Client.abortCopy to cancel a pending copy.
copyStatusCopyStatusThe status of the copy.
copyProgressCopyProgressProgress of the copy (bytes copied so far out of the total).

CopyProgress​

Progress of an asynchronous copy operation.

FieldTypeDescription
copiedBytesintThe number of bytes copied so far.
totalBytesintThe total number of bytes to be copied.

Range​

A single byte range within a file. Both bounds are inclusive (a range starting at offset o with length l is startByte = o, endByte = o + l - 1).

FieldTypeDescription
startByteintThe zero-based inclusive start offset.
endByteintThe zero-based inclusive end offset.

RangeDiff​

The result of Client.listRangesDiff: how a file's ranges changed since a share snapshot.

FieldTypeDescription
rangesRange[]The ranges written since the baseline snapshot.
clearRangesRange[]The ranges cleared since the baseline snapshot.

ShareSnapshotInfo​

One share snapshot, as returned by Client.createShareSnapshot and Client.listShareSnapshots.

FieldTypeDescription
snapshotIdstringThe snapshot identifier, an opaque UTC-timestamp-formatted string. Pass it as the snapshotId of the download and list options to read from the snapshot.
eTagstringThe entity tag of the share at the moment of the snapshot.
lastModifiedtime:UtcThe last-modified time of the share at the moment of the snapshot (UTC).

ServiceProperties​

The account's file-service configuration: request-metrics collection and cross-origin resource sharing rules.

FieldTypeDescription
hourMetricsMetricsMetrics aggregated per hour.
minuteMetricsMetricsMetrics aggregated per minute.
corsCorsRule[]The CORS (Cross-Origin Resource Sharing) rules, evaluated in order; at most five.
protocolProtocolSettingsProtocol-level settings.

Metrics​

A metrics-collection setting of the file service.

FieldTypeDescription
enabledbooleanWhether metrics are collected.
versionstringThe storage-analytics version the setting applies to.
includeApisbooleanWhether metrics cover called API operations as well as storage capacity.
retentionDaysintHow many days collected metrics are retained.

CorsRule​

One CORS (Cross-Origin Resource Sharing) rule of the file service. The string fields are comma-separated lists; * allows all.

FieldTypeDescription
allowedOriginsstringThe origin domains allowed to make requests.
allowedMethodsstringThe HTTP methods an allowed origin may use.
allowedHeadersstringThe request headers an allowed origin may send.
exposedHeadersstringThe response headers exposed to the browser.
maxAgeInSecondsintHow long, in seconds, a browser may cache the preflight response.

ProtocolSettings​

Protocol-level settings of the file service.

FieldTypeDescription
smbMultichannelEnabledbooleanWhether SMB multichannel (multiple parallel network channels per SMB session) is enabled for the account.

UserDelegationKey​

A key for signing user-delegation SAS tokens, obtained via AdminClient.getUserDelegationKey.

FieldTypeDescription
signedObjectIdstringThe object id of the Entra ID principal the key was issued to.
signedTenantIdstringThe Entra ID tenant the key was issued in.
signedStarttime:UtcThe start of the key's validity period (UTC).
signedExpirytime:UtcThe end of the key's validity period (UTC).
signedServicestringThe service the key is valid for.
signedVersionstringThe storage service version the key was issued for.
valuestringThe key itself, base64-encoded.

Enums​

  • ShareAccessTier: HOT, COOL, TRANSACTION_OPTIMIZED, PREMIUM.
  • ShareProtocol: SMB, NFS.
  • FileFormat: JSON, XML, CSV.
  • ShareSnapshotsDeleteOption: INCLUDE, INCLUDE_LEASED.
  • NfsRootSquash: NO_ROOT_SQUASH, ROOT_SQUASH, ALL_SQUASH.
  • CopyStatus: PENDING, SUCCESS, ABORTED, FAILED.
  • LeaseState: AVAILABLE, LEASED, EXPIRED, BREAKING, BROKEN.
  • LeaseStatus: LOCKED, UNLOCKED.
  • LeaseDuration: INFINITE, FIXED.
  • SasProtocol: HTTPS, HTTPS_HTTP.
  • RetryPolicyType: EXPONENTIAL, FIXED_INTERVAL.
  • ProxyType: HTTP, SOCKS4, SOCKS5.

Errors​

Every operation returns the module's Error on failure. The hierarchy splits by origin:

  • Error: the root type, and the type of every client-side failure (invalid configuration, local I/O, content that fails to bind). It carries no detail fields, with one exception:
    • ContentBindingError: a listener-only error raised when a dispatched file's content does not bind to its handler's declared type. It is delivered to the service's onError handler and carries the file's share-relative path in filePath and, when the content had been downloaded before binding failed, its raw bytes in content. See the Trigger Reference.
  • ServiceError: any error the Azure service raised, always carrying httpStatus and errorCode. Its subtypes are NotFoundError (404), ConflictError (409), AuthorizationError (403), PreconditionFailedError (412), RangeNotSatisfiableError (416), and QuotaExceededError (403, the share is full). An unmapped service code lands on the generic ServiceError.

The mapping keys on the Azure error-code string rather than the HTTP status alone, so ShareSizeLimitReached (403) becomes a QuotaExceededError while an auth failure (also 403) becomes an AuthorizationError. Check the more specific error types before the general ones.