[Storage Emulator] Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature
See original GitHub issueHi,
I am getting below error while accessing blob container by using SAS token with storage emulator -
**Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature
System.AggregateException: One or more errors occurred. (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:c3d554bf-ae0c-413d-ba15-ef888f141864 Time:2020-08-19T08:18:01.6796671Z Status: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.) ErrorCode: AuthenticationFailed
Headers: Server: Microsoft-HTTPAPI/2.0 x-ms-request-id: c3d554bf-ae0c-413d-ba15-ef888f141864 x-ms-error-code: AuthenticationFailed Date: Wed, 19 Aug 2020 08:18:01 GMT Content-Length: 498 Content-Type: application/xml**
Expected behavior What is the expected behavior?
Below are the Exception or Stack Trace details - —> Azure.RequestFailedException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:0b506bfc-ba50-4519-924f-6072c5ba829d Time:2020-08-19T08:47:57.3367759Z Status: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.) ErrorCode: AuthenticationFailed
Headers: Server: Microsoft-HTTPAPI/2.0 x-ms-request-id: 0b506bfc-ba50-4519-924f-6072c5ba829d x-ms-error-code: AuthenticationFailed Date: Wed, 19 Aug 2020 08:47:57 GMT Content-Length: 498 Content-Type: application/xml
at Azure.Storage.Blobs.BlobRestClient.Service.GetPropertiesAsync_CreateResponse(ClientDiagnostics clientDiagnostics, Response response) at Azure.Storage.Blobs.BlobRestClient.Service.GetPropertiesAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri resourceUri, String version, Nullable`1 timeout, String requestId, Boolean async, String operationName, CancellationToken cancellationToken) at Azure.Storage.Blobs.BlobServiceClient.GetPropertiesInternal(Boolean async, CancellationToken cancellationToken) at Azure.Storage.Blobs.BlobServiceClient.GetPropertiesAsync(CancellationToken cancellationToken)
To Reproduce
-
I am referring sample example - https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blobs/samples/Sample02_Auth.cs
-
Below is the code to reproduce -
` Create a SAS token that’s valid for one hour. BlobSasBuilder sasBuilder = new BlobSasBuilder { BlobContainerName = containerName, Resource = “c”, //StartsOn = DateTimeOffset.UtcNow, //ExpiresOn = DateTimeOffset.UtcNow.AddHours(1) ExpiresOn = DateTimeOffset.MaxValue };
//Allow read access
sasBuilder.SetPermissions(BlobContainerSasPermissions.Read);
StorageSharedKeyCredential credential =
new StorageSharedKeyCredential("Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==", "devstoreaccount1");
// Use the key to get the SAS token.
string sasToken = sasBuilder.ToSasQueryParameters(credential).ToString();
Console.WriteLine("SAS for blob container is: {0}", sasToken);
Console.WriteLine();
// Build a SAS URI
UriBuilder sasUri = new UriBuilder(containerClient.Uri);
sasUri.Query = sasToken;
// Create a client that can authenticate with the SAS URI
BlobServiceClient service = new BlobServiceClient(sasUri.Uri);
// Make a service request to verify we've successfully authenticated
await service.GetPropertiesAsync(); //Note - Receiving above error while calling this function
`
Environment:
- Azure.Storage.Blobs Version=“12.5.0”
- NET Core SDKs installed: 2.1.602 [C:\Program Files\dotnet\sdk] 2.1.802 [C:\Program Files\dotnet\sdk] 2.2.202 [C:\Program Files\dotnet\sdk] 2.2.402 [C:\Program Files\dotnet\sdk] 3.1.302 [C:\Program Files\dotnet\sdk]
- IDE and version : Microsoft Visual Studio Enterprise 2019 Version 16.6.5
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
We are experiencing the same error when connecting to blob storage. Started failing when we updated Azure.Storage.Blobs from 12.4.4 to 12.5.1
Hi Folks, Development on the storage emulator has been stopped in favor of Azurite. Could you guys give that a try and let us know if you hit issues?