Plinth Azure Providers for Blob Storage
$ dotnet add package Plinth.Storage.AzureStorage Provider for Plinth.Storage to write blob data to Azure Blob Storage
Enables storing the blob data used by Plinth.Storage in Azure Blob Storage
This package adds these extension methods to Plinth.Storage.StorageFactory to utilize Azure Blob Storage
storageFactory.AddAzureBlobProvider(new AzureBlobSettings()
{
ConnectionString = "{from-azure-portal}",
ContainerName = "MyBlobs"
});
storageFactory.SetDefaultWriteProviderAsAzureBlob();
By default, this will write blobs to the root of the container. There are 2 other built in options for futher segmenting the blobs. To use these, set DefaultIndexStrategy in AzureBlobSettings
DefaultIndexStrategy.ByDate
This will place the blobs in a sub folder with the current date as /YY/MM/DD/{blobId}
DefaultIndexStrategy.ByDateTime
This will place the blobs in a sub folder with the current date and current hour as /YY/MM/DD/HH/{blobId}
By default, blobs will be written to the container specified. This library supports writing a backup to a second container.
To enable, supply BackupContainerName in AzureBlobSettings and each write will write to both containers.
Also supported is writing the backup to an entirely different storage account.
To enable, supply BackupConnectionString in AzureBlobSettings and the backup will be written to the alternate account.
By default, the blobs will a file extension in blob storage which come from the blob name field. This allows for browsers to more easily download those files directly.
To disable this, set DisableBlobExtensions to true in AzureBlobSettings and the blobs will not have a file extension.