Is there any way to programmatically retrieve the maximum allowed size for an Azure Blob? Also for a block in a blob?
I know of no way to query the maximum size on demand, but I believe the value you are looking for is stored as a constant in the .net SDK.
Constants.MaxBlobSize
and Constants.MaxBlockSize
in the Microsoft.WindowsAzure.Storage.Shared.Protocol
namespace would be the values you are interested in.
/// <summary>
/// The maximum size of a blob with blocks.
/// </summary>
public const long MaxBlobSize = MaxBlockNumber * MaxBlockSize;
With MaxBlockSize being
/// <summary>
/// The maximum size of a single block for Block Blobs.
/// </summary>
public const int MaxBlockSize = (int)(100 * Constants.MB);
Source (Constants.cs)
Taken from https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-how-to-use-blobs#writing-to-an-append-blob
Each block in an append blob can be a different size, up to a maximum of 4 MB, and an append blob can include a maximum of 50,000 blocks. The maximum size of an append blob is therefore slightly more than 195 GB (4 MB X 50,000 blocks).
Is there any way to programmatically retrieve the maximum allowed size for an Azure Blob? Also for a block in a blob?
As of today, no. There's no programmatic way of retrieving this information. However this information is well published here and it does not changes very often. Since 2008, I believe the size has changed only once and that too for block blobs.
Here're the limits as of today:
Max Size: 4.75 TB (if you use Service Version 2016-05-31 or greater)
Max Size: 195 GB (if you use Service Version prior to 2016-05-31)
Max Block Size: 100MB (if you use Service Version 2016-05-31 or greater)
Max Block Size: 4MB (if you use Service Version prior to 2016-05-31)
Max Number of Blocks: 50000
Max Size: 1TB
Max Size: 195GB
Max Block Size: 4MB
Max Number of Blocks: 50000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With