SAS token not working when accessing storage account even though it has valid expiry dates

Srinivas, Venkatesh 0 Reputation points
2023-12-08T13:47:49.8233333+00:00

I was using SAS token to connect to azure storage and it was working fine but all of a sudden it throws error and when I checked token it has valid dates.

Below is the error

Error while uploading file data to Azure, Message Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature., Exception [com.microsoft.azure.storage.StorageException.translateException(StorageException.java:87)

Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,539 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sumarigo-MSFT 47,471 Reputation points Microsoft Employee Moderator
    2023-12-12T15:11:12.4066667+00:00

    @Srinivas, Venkatesh Apologies for the delay response!

    Based on the error message it indicates that the server failed to authenticate the request and that you should check the value of the Authorization header to make sure it is formed correctly, including the signature.

    Can you also re-confirm the access keys were not refreshed etc., by confirming they match with the keys in the Portal?

    • Are you trying to upload to Files or blob storage?
    • Verify System Time(Make sure that the system time on the machine generating the SAS token is accurate. A significant time discrepancy could lead to authentication failures)
    • Try to regenerate New SAS token and upload
    • For testing purpose can you upload using Storage account key and Storage explorer or azcopy tool?

    Here are some things you can check to troubleshoot the issue:

    1. Check if the SAS token has expired. Even though the SAS token has valid dates, it is possible that it has expired. Make sure that the SAS token is still valid and has not expired.
    2. Check if the SAS token has the correct permissions. Make sure that the SAS token has the correct permissions to upload files to the Azure storage account.
    3. Check if the SAS token has the correct format. Make sure that the SAS token has the correct format and that it includes all the required parameters.
    4. Check if there are any network connectivity issues. Make sure that there are no network connectivity issues that may be preventing the request from being authenticated.

    Additional Information :

    Reference link : https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview#best-practices-when-using-sas:
    Based on the error message there is similar thread discussion here which gives some idea on your issue.

    Please let us know if you have any further queries. I’m happy to assist you further.     


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.