Error: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature
See original GitHub issueI’m doing tests using MSI to access / manipulate a storage account. I’m getting a token using the following code:
static string GetUserOAuthToken(string tenantId, string applicationId, string clientSecret)
{
const string ResourceId = "https://storage.azure.com/";
const string AuthInstance = "https://login.microsoftonline.com/{0}/";
string authority = string.Format(CultureInfo.InvariantCulture, AuthInstance, tenantId);
AuthenticationContext authContext = new AuthenticationContext(authority);
var clientCred = new ClientCredential(applicationId, clientSecret);
AuthenticationResult result = authContext.AcquireTokenAsync(
ResourceId,
clientCred
).Result;
return result.AccessToken;
}
with the token, I’m trying to upload a blob, but getting the following error:
“Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature”
PS: I don’t have Application Insights, so it’s not related with #416
An here’s the code to access the blob:
TokenCredential tokenCredential = new TokenCredential(token);
StorageCredentials storageCredentials = new StorageCredentials(tokenCredential);
CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(storageCredentials, "SECRET", "core.windows.net", useHttps: true);
CloudBlobClient blobClient = cloudStorageAccount.CreateCloudBlobClient();
blobClient.AuthenticationScheme = AuthenticationScheme.Token;
CloudBlobContainer blobContainer = blobClient.GetContainerReference("test");
var blob = blobContainer.GetBlockBlobReference("asdasdasdasd.txt");
blob.UploadTextAsync("oi").Wait();
Using the version 9.3.3 of WindowsAzure.Storage lib
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
AzureStorage Blob Server failed to authenticate ...
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. The error ...
Read more >Azure Blob Storage fails to authenticate: "Make sure the ...
Azure Blob Storage fails to authenticate: "Make sure the value of Authorization header is formed correctly including the signature".
Read more >Microsoft.Azure.Storage.StorageException: Server failed to ...
StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. #176.
Read more >Error "Server failed to authenticate the request" while ...
If request authentication is failing, that means there is an issue with the SAS token provided while configuring the job. You need to...
Read more >Error Message: “Server failed to authenticate the request. ...
Error Message: “Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s an example of using an Oauth token:
In my case, I have restarted the docker desktop (host). If figured out that this happen when the machine goes to sleep.