2

Getting the following error:

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

I'm using WindowsAzure.Storage package to get the blob stream, very simple.

 _blobClient = CloudStorageAccount
                .Parse(options.ConnectionString)
                .CreateCloudBlobClient();

  var blob = _blobClient.GetContainerReference(containerName)
                .GetBlobReference(blobName);

var file = await blob.OpenReadAsync(null, _requestOptions,
_context).ConfigureAwait(false);

I've tried using the Account Key and Name and the Connection String and the result is the same.

Same happens using Azure Storage Explorer, i cannot upload any file to the Storage. ( just keeps uploading with 0% progress ). Only works if i connect directly with my Microsoft Account.

enter image description here

  • My computer time and timezone are set automatically.
  • The region for the storage is Southeast Asia, East Asia

Is there any extra configuration that needs to be done?

Thank you

David Freire
  • 671
  • 9
  • 23
  • 1
    Please check for 2 things: 1) Storage account key used is correct. 2) Time on your local machine is correct. In my experience these are the two reasons you would get the error you're getting. – Gaurav Mantri Oct 25 '17 at 15:56
  • Are you accessing the storage using a shared access token (SAS)? – aaronR Oct 25 '17 at 16:38
  • @GauravMantri the storage account was copied directly from Azure Portal and the time and the timezone are set automatically. It's a fresh new account. My timezone is UTC +8:00 and the selected region for the Storage is Southeast Asia, East Asia. – David Freire Oct 26 '17 at 00:49
  • @aaronR using storage account and key – David Freire Oct 26 '17 at 03:21
  • 1
    David...When you get the error in your code, can you check the `RequestInformation` property of the StorageException you get? Normally you will find more details about this error (please look inside `ExtendedErrorInformation` in there). Please update your question with those details. Thanks. – Gaurav Mantri Oct 26 '17 at 03:32
  • @GauravMantri you were right.. it is the time. I am using Xamarin and Android emulator and it doesn't use the server time. Thanks for your great help! – David Freire Oct 26 '17 at 13:20

1 Answers1

1

I was running the code in an Android emulator where the timezone is different from the host. Timezone needs to be set device level so that the header signature is sent correctly to the Azure API.

This solved the problem.

David Freire
  • 671
  • 9
  • 23