azure-storage-net-data-movement: Microsoft.Azure.Storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

Which service(blob, file) does this issue concern?

azure blob

Which version of the SDK was used?

0.11.0

On which platform were you using? (.Net Framework version or .Net Core version, and OS version)

.netframework

How can the problem be reproduced? It’d be better if the code caused the problem can be shared.

this is intermittent in nature, some times happens even after multiple retries, code used as below happening when using the code from azure batch

`DownloadOptions options = new DownloadOptions(); options.DisableContentMD5Validation = true;

        SingleTransferContext sharedTransferContext = new SingleTransferContext();


        TransferManager.DownloadAsync(blob, path + Path.DirectorySeparatorChar + name, options, sharedTransferContext).Wait();`

What problem was encountered?

Unhandled Exception: System.AggregateException: One or more errors occurred. —> Microsoft.Azure.Storage.DataMovement.TransferException: The transfer failed. —> Microsoft.Azure.Storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

Have you found a mitigation/solution?

No

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 4
  • Comments: 33

Most upvoted comments

This exception is EXTREME misleading!!

With my experiences, a lot of runtime error, use error could result this…

  1. if you are copying /pasting files via azure storage explorer, you might result your pasted files locked for no reason and can not be updated by your data job…
  2. if you are batching some processing and write the output of the files to blob container via IBinder writeAsync, you may result this as there is a race condition and the process could be jammed
  3. If you network is not quite reliable, and a file upload attempt is timeout, you may also see this… blob/storage service itself is implemented via HTTP protocol, for large files, some limitations could always result something unexpectantly.

I personally find it is super frustration. following resource might help a little.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-best-practices https://docs.microsoft.com/en-us/azure/storage/blobs/storage-performance-checklist

There is always a long way to go for Microsoft to make a better cloud I/O.

This is relevant only if SAS tokens are used but sharing as reference that we observed this same error message and the root cause turned out to be the issue warned about at https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview#best-practices-when-using-sas:

Be careful with SAS start time. If you set the start time for a SAS to now, then due to clock skew (differences in current time according to different machines), failures may be observed intermittently for the first few minutes. In general, set the start time to be at least 15 minutes in the past. Or, don’t set it at all, which will make it valid immediately in all cases.

In our case, the start time is not required so the fix was to get rid of the StartsOn property which was a diff like below with the .NET SDK:

BlobSasBuilder sasBuilder = new BlobSasBuilder()
{
    BlobContainerName = containerName,
    BlobName = blobName,
    Resource = "b",
-   StartsOn = DateTimeOffset.UtcNow,
    ExpiresOn = DateTimeOffset.UtcNow.AddHours(1)
};