BlobClientOptions
Provides the client configuration options for connecting to Azure Blob
Storage.
using Azure.Core.Pipeline;
using Azure.Storage.Blobs.Models;
using Azure.Storage.Shared;
using System;
namespace Azure.Storage.Blobs
{
public class BlobClientOptions : ISupportsTenantIdChallenges
{
public enum ServiceVersion
{
V2019_02_02 = 1,
V2019_07_07,
V2019_12_12,
V2020_02_10,
V2020_04_08,
V2020_06_12,
V2020_08_04,
V2020_10_02,
V2020_12_06,
V2021_02_12,
V2021_04_10,
V2021_06_08,
V2021_08_06,
V2021_10_04,
V2021_12_02,
V2022_11_02,
V2023_01_03,
V2023_05_03,
V2023_08_03,
V2023_11_03,
V2024_02_04,
V2024_05_04,
V2024_08_04,
V2024_11_04,
V2025_01_05
}
internal const ServiceVersion LatestVersion = ServiceVersion.V2025_01_05;
internal ClientSideEncryptionOptions _clientSideEncryptionOptions;
public ServiceVersion Version { get; }
public CustomerProvidedKey? CustomerProvidedKey { get; set; }
public string EncryptionScope { get; set; }
public Uri GeoRedundantSecondaryUri { get; set; }
public TransferValidationOptions TransferValidation { get; } = new TransferValidationOptions();
public bool TrimBlobNameSlashes { get; set; } = true;
public Request100ContinueOptions Request100ContinueOptions { get; set; }
public bool EnableTenantDiscovery { get; set; }
public BlobAudience? Audience { get; set; }
public BlobClientOptions(ServiceVersion version = ServiceVersion.V2025_01_05)
: this()
{
if (ServiceVersion.V2019_02_02 > version || version > ServiceVersion.V2025_01_05)
throw Errors.VersionNotSupported("version");
Version = version;
this.Initialize();
AddHeadersAndQueryParameters();
}
private void AddHeadersAndQueryParameters()
{
this.get_Diagnostics().get_LoggedHeaderNames().Add("Access-Control-Allow-Origin");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-date");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-error-code");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-request-id");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-version");
this.get_Diagnostics().get_LoggedHeaderNames().Add("Accept-Ranges");
this.get_Diagnostics().get_LoggedHeaderNames().Add("Content-Disposition");
this.get_Diagnostics().get_LoggedHeaderNames().Add("Content-Encoding");
this.get_Diagnostics().get_LoggedHeaderNames().Add("Content-Language");
this.get_Diagnostics().get_LoggedHeaderNames().Add("Content-MD5");
this.get_Diagnostics().get_LoggedHeaderNames().Add("Content-Range");
this.get_Diagnostics().get_LoggedHeaderNames().Add("Vary");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-content-crc64");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-action");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-completion-time");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-id");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-progress");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-status");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-has-immutability-policy");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-has-legal-hold");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-lease-state");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-lease-status");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-range");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-request-server-encrypted");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-server-encrypted");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-snapshot");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-source-range");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-access-tier");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-access-tier-change-time");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-access-tier-inferred");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-account-kind");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-archive-status");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-append-offset");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-cache-control");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-committed-block-count");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-condition-appendpos");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-condition-maxsize");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-content-disposition");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-content-encoding");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-content-language");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-content-length");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-content-md5");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-content-type");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-public-access");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-sequence-number");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-blob-type");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-destination-snapshot");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-creation-time");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-default-encryption-scope");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-delete-snapshots");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-delete-type-permanent");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-deny-encryption-scope-override");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-encryption-algorithm");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-if-sequence-number-eq");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-if-sequence-number-le");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-if-sequence-number-lt");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-incremental-copy");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-lease-action");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-lease-break-period");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-lease-duration");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-lease-id");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-lease-time");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-page-write");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-proposed-lease-id");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-range-get-content-md5");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-rehydrate-priority");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-sequence-number-action");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-sku-name");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-source-content-md5");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-source-if-match");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-source-if-modified-since");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-source-if-none-match");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-source-if-unmodified-since");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-tag-count");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-encryption-key-sha256");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-source-error-code");
this.get_Diagnostics().get_LoggedHeaderNames().Add("x-ms-copy-source-status-code");
this.get_Diagnostics().get_LoggedQueryParameters().Add("comp");
this.get_Diagnostics().get_LoggedQueryParameters().Add("maxresults");
this.get_Diagnostics().get_LoggedQueryParameters().Add("rscc");
this.get_Diagnostics().get_LoggedQueryParameters().Add("rscd");
this.get_Diagnostics().get_LoggedQueryParameters().Add("rsce");
this.get_Diagnostics().get_LoggedQueryParameters().Add("rscl");
this.get_Diagnostics().get_LoggedQueryParameters().Add("rsct");
this.get_Diagnostics().get_LoggedQueryParameters().Add("se");
this.get_Diagnostics().get_LoggedQueryParameters().Add("si");
this.get_Diagnostics().get_LoggedQueryParameters().Add("sip");
this.get_Diagnostics().get_LoggedQueryParameters().Add("sp");
this.get_Diagnostics().get_LoggedQueryParameters().Add("spr");
this.get_Diagnostics().get_LoggedQueryParameters().Add("sr");
this.get_Diagnostics().get_LoggedQueryParameters().Add("srt");
this.get_Diagnostics().get_LoggedQueryParameters().Add("ss");
this.get_Diagnostics().get_LoggedQueryParameters().Add("st");
this.get_Diagnostics().get_LoggedQueryParameters().Add("sv");
this.get_Diagnostics().get_LoggedQueryParameters().Add("include");
this.get_Diagnostics().get_LoggedQueryParameters().Add("marker");
this.get_Diagnostics().get_LoggedQueryParameters().Add("prefix");
this.get_Diagnostics().get_LoggedQueryParameters().Add("copyid");
this.get_Diagnostics().get_LoggedQueryParameters().Add("restype");
this.get_Diagnostics().get_LoggedQueryParameters().Add("blockid");
this.get_Diagnostics().get_LoggedQueryParameters().Add("blocklisttype");
this.get_Diagnostics().get_LoggedQueryParameters().Add("delimiter");
this.get_Diagnostics().get_LoggedQueryParameters().Add("prevsnapshot");
this.get_Diagnostics().get_LoggedQueryParameters().Add("ske");
this.get_Diagnostics().get_LoggedQueryParameters().Add("skoid");
this.get_Diagnostics().get_LoggedQueryParameters().Add("sks");
this.get_Diagnostics().get_LoggedQueryParameters().Add("skt");
this.get_Diagnostics().get_LoggedQueryParameters().Add("sktid");
this.get_Diagnostics().get_LoggedQueryParameters().Add("skv");
this.get_Diagnostics().get_LoggedQueryParameters().Add("snapshot");
}
internal HttpPipeline Build(HttpPipelinePolicy authentication = null)
{
return StorageClientOptions.Build(this, authentication, GeoRedundantSecondaryUri, Request100ContinueOptions);
}
internal HttpPipeline Build(object credentials)
{
return StorageClientOptions.Build(this, credentials, GeoRedundantSecondaryUri, Request100ContinueOptions);
}
}
}