BlobServiceClient
The BlobServiceClient allows you to manipulate Azure
Storage service resources and blob containers. The storage account provides
the top-level namespace for the Blob service.
Gets the Storage account name corresponding to the service client.
Determines whether the client is able to generate a SAS.
If the client is authenticated with a StorageSharedKeyCredential.
Gets the blob service's primary Uri endpoint.
protected BlobServiceClient()
Initializes a new instance of the BlobServiceClient
class for mocking.
Initializes a new instance of the BlobServiceClient
class.
Initializes a new instance of the BlobServiceClient
class.
Initializes a new instance of the BlobServiceClient
class.
public BlobServiceClient(Uri serviceUri, StorageSharedKeyCredential credential, BlobClientOptions options = null)
Initializes a new instance of the BlobServiceClient
class.
public BlobServiceClient(Uri serviceUri, AzureSasCredential credential, BlobClientOptions options = null)
Initializes a new instance of the BlobServiceClient
class.
public BlobServiceClient(Uri serviceUri, TokenCredential credential, BlobClientOptions options = null)
Initializes a new instance of the BlobServiceClient
class.
protected static BlobServiceClient CreateClient(Uri serviceUri, BlobClientOptions options, HttpPipelinePolicy authentication, HttpPipeline pipeline, StorageSharedKeyCredential sharedKeyCredential, AzureSasCredential sasCredential, TokenCredential tokenCredential)
Intended for DataLake to create a backing blob client.
Initializes a new instance of the BlobServiceClient
class.
protected static BlobServiceClient CreateClient(Uri serviceUri, BlobClientOptions options, HttpPipelinePolicy authentication, HttpPipeline pipeline)
Intended for DataLake to create a backing blob client.
Initializes a new instance of the BlobServiceClient
class.
Get a BlobServiceClient's authentication
HttpPipelinePolicy for creating child clients.
Get a BlobServiceClient's BlobClientOptions
for creating child clients.
Get a BlobServiceClient's HttpPipeline
for creating child clients.
public virtual Response<BlobContainerClient> CreateBlobContainer(string blobContainerName, PublicAccessType publicAccessType = 0, IDictionary<string, string> metadata = null, CancellationToken cancellationToken = default)
The CreateBlobContainer operation creates a new
blob container under the specified account. If the container with the
same name already exists, the operation fails.
For more information, see
Create Container.
public virtual Task<Response<BlobContainerClient>> CreateBlobContainerAsync(string blobContainerName, PublicAccessType publicAccessType = 0, IDictionary<string, string> metadata = null, CancellationToken cancellationToken = default)
The CreateBlobContainerAsync operation creates a new
blob container under the specified account. If the container with the
same name already exists, the operation fails.
For more information, see
Create Container.
public virtual Response DeleteBlobContainer(string blobContainerName, BlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The DeleteBlobContainer operation marks the
specified blob container for deletion.
For more information, see
Delete Container.
public virtual Task<Response> DeleteBlobContainerAsync(string blobContainerName, BlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The DeleteBlobContainerAsync operation marks the
specified container for deletion.
For more information, see
Delete Container.
public virtual Pageable<TaggedBlobItem> FindBlobsByTags(string tagFilterSqlExpression, CancellationToken cancellationToken = default)
The Filter Blobs operation enables callers to list blobs across all containers whose tags
match a given search expression and only the tags appearing in the expression will be returned.
Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container.
For more information, see
Find Blobs by Tags.
public virtual AsyncPageable<TaggedBlobItem> FindBlobsByTagsAsync(string tagFilterSqlExpression, CancellationToken cancellationToken = default)
The Filter Blobs operation enables callers to list blobs across all containers whose tags
match a given search expression. Filter blobs searches across all containers within a
storage account but can be scoped within the expression to a single container.
For more information, see
Find Blobs by Tags.
public Uri GenerateAccountSasUri(AccountSasPermissions permissions, DateTimeOffset expiresOn, AccountSasResourceTypes resourceTypes)
The GenerateAccountSasUri
returns a Uri that generates a Blob Account
Shared Access Signature (SAS) based on the Client properties
and parameters passed. The SAS is signed by the
shared key credential of the client.
To check if the client is able to sign a Service Sas see
CanGenerateAccountSasUri.
For more information, see
Constructing an Account SAS.
public Uri GenerateAccountSasUri(AccountSasPermissions permissions, DateTimeOffset expiresOn, AccountSasResourceTypes resourceTypes, out string stringToSign)
The GenerateAccountSasUri
returns a Uri that generates a Blob Account
Shared Access Signature (SAS) based on the Client properties
and parameters passed. The SAS is signed by the
shared key credential of the client.
To check if the client is able to sign a Service Sas see
CanGenerateAccountSasUri.
For more information, see
Constructing an Account SAS.
The GenerateAccountSasUri returns a Uri that
generates a Blob Account Shared Access Signature (SAS) based on the
Client properties and builder passed. The SAS is signed by the
shared key credential of the client.
To check if the client is able to sign a Service Sas see
CanGenerateAccountSasUri.
For more information, see
Constructing an Account SAS.
The GenerateAccountSasUri returns a Uri that
generates a Blob Account Shared Access Signature (SAS) based on the
Client properties and builder passed. The SAS is signed by the
shared key credential of the client.
To check if the client is able to sign a Service Sas see
CanGenerateAccountSasUri.
For more information, see
Constructing an Account SAS.
The GetAccountInfo operation returns the sku
name and account kind for the specified account.
For more information, see
Get Account Information.
public virtual Task<Response<AccountInfo>> GetAccountInfoAsync(CancellationToken cancellationToken = default)
The GetAccountInfoAsync operation returns the sku
name and account kind for the specified account.
For more information, see
Get Account Information.
Create a new BlobContainerClient object by appending
blobContainerName to the end of Uri.
The new BlobContainerClient uses the same request
policy pipeline as the BlobServiceClient.
public virtual Pageable<BlobContainerItem> GetBlobContainers(BlobContainerTraits traits = 0, BlobContainerStates states = 0, string prefix = null, CancellationToken cancellationToken = default)
The GetBlobContainers
operation returns a sequence of blob containers in the storage account. Enumerating the
blob containers may make multiple requests to the service while fetching
all the values. Containers are ordered lexicographically by name.
For more information,
see List Containers.
public virtual Pageable<BlobContainerItem> GetBlobContainers(BlobContainerTraits traits, string prefix, CancellationToken cancellationToken)
The GetBlobContainers operation returns an async
sequence of blob containers in the storage account. Enumerating the
blob containers may make multiple requests to the service while fetching
all the values. Containers are ordered lexicographically by name.
For more information, see
List Containers.
public virtual AsyncPageable<BlobContainerItem> GetBlobContainersAsync(BlobContainerTraits traits = 0, BlobContainerStates states = 0, string prefix = null, CancellationToken cancellationToken = default)
The GetBlobContainersAsync
operation returns an async sequence of blob containers in the storage account. Enumerating the
blob containers may make multiple requests to the service while fetching
all the values. Containers are ordered lexicographically by name.
For more information, see
List Containers.
public virtual AsyncPageable<BlobContainerItem> GetBlobContainersAsync(BlobContainerTraits traits, string prefix, CancellationToken cancellationToken)
The GetBlobContainersAsync
operation returns an async sequence of blob containers in the storage account. Enumerating the
blob containers may make multiple requests to the service while fetching
all the values. Containers are ordered lexicographically by name.
For more information, see
List Containers.
public virtual Response<BlobServiceProperties> GetProperties(CancellationToken cancellationToken = default)
The GetProperties operation gets the properties
of a storage account’s blob service, including properties for
Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
For more information, see
Get Blob Service Properties.
public virtual Task<Response<BlobServiceProperties>> GetPropertiesAsync(CancellationToken cancellationToken = default)
The GetPropertiesAsync operation gets the properties
of a storage account’s blob service, including properties for
Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
For more information, see
Get Blob Service Properties.
public virtual Response<BlobServiceStatistics> GetStatistics(CancellationToken cancellationToken = default)
The GetStatistics operation retrieves
statistics related to replication for the Blob service. It is
only available on the secondary location endpoint when read-access
geo-redundant replication ( StandardRagrs)
is enabled for the storage account.
For more information, see
Get Blob Service Stats.
public virtual Task<Response<BlobServiceStatistics>> GetStatisticsAsync(CancellationToken cancellationToken = default)
The GetStatisticsAsync operation retrieves
statistics related to replication for the Blob service. It is
only available on the secondary location endpoint when read-access
geo-redundant replication ( StandardRagrs)
is enabled for the storage account.
For more information, see
Get Blob Service Stats.
public virtual Response<UserDelegationKey> GetUserDelegationKey(DateTimeOffset? startsOn, DateTimeOffset expiresOn, CancellationToken cancellationToken = default)
The GetUserDelegationKey operation retrieves a
key that can be used to delegate Active Directory authorization to
shared access signatures created with BlobSasBuilder.
public virtual Task<Response<UserDelegationKey>> GetUserDelegationKeyAsync(DateTimeOffset? startsOn, DateTimeOffset expiresOn, CancellationToken cancellationToken = default)
The GetUserDelegationKeyAsync operation retrieves a
key that can be used to delegate Active Directory authorization to
shared access signatures created with BlobSasBuilder.
public virtual Response SetProperties(BlobServiceProperties properties, CancellationToken cancellationToken = default)
The SetProperties operation sets properties for
a storage account’s Blob service endpoint, including properties
for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules
and soft delete settings. You can also use this operation to set
the default request version for all incoming requests to the Blob
service that do not have a version specified.
For more information, see
Set Blob Service Properties.
public virtual Task<Response> SetPropertiesAsync(BlobServiceProperties properties, CancellationToken cancellationToken = default)
The SetPropertiesAsync operation sets properties for
a storage account’s Blob service endpoint, including properties
for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules
and soft delete settings. You can also use this operation to set
the default request version for all incoming requests to the Blob
service that do not have a version specified.
For more information, see
Set Blob Service Properties.
public virtual Response<BlobContainerClient> UndeleteBlobContainer(string deletedContainerName, string deletedContainerVersion, CancellationToken cancellationToken = default)
Restores a previously deleted container.
This API is only functional is Container Soft Delete is enabled
for the storage account associated with the container.
public virtual Response<BlobContainerClient> UndeleteBlobContainer(string deletedContainerName, string deletedContainerVersion, string destinationContainerName, CancellationToken cancellationToken = default)
Restores a previously deleted container.
This API is only functional is Container Soft Delete is enabled
for the storage account associated with the container.
public virtual Task<Response<BlobContainerClient>> UndeleteBlobContainerAsync(string deletedContainerName, string deletedContainerVersion, CancellationToken cancellationToken = default)
Restores a previously deleted container.
This API is only functional is Container Soft Delete is enabled
for the storage account associated with the container.
public virtual Task<Response<BlobContainerClient>> UndeleteBlobContainerAsync(string deletedContainerName, string deletedContainerVersion, string destinationContainerName, CancellationToken cancellationToken = default)
Restores a previously deleted container.
This API is only functional is Container Soft Delete is enabled
for the storage account associated with the container.