Suddenly unable to access blob storage using sas token

Akker, Sander van den 25 Reputation points
2024-10-16T07:53:50.5633333+00:00

Since a couple of days I am experiencing issues connecting to an Azure blob storage using a generated sas token. These used to work just fine unti Oct 12th ~00:00 UTC.

I use the following commands to generate a sas token and use it to write a file to a blob storage:

 az login --service-principal -u <principal_id> -p <principal_password> --tenant <tenant_id>

export TOKEN=$(az storage container generate-sas --account-name <storage_account_name> --name backups --permissions rwdl --auth-mode login --as-user --expiry 2024-10-19 -o tsv)

az redis export --subscription <subscription_name> --resource-group <resource_group_name> --name <name> --prefix $(date +"%Y-%m-%d")/$(date +"%H%M")/backup --container https://<storage_account_name>.blob.core.windows.net/backups\?$\{TOKEN\}

The token is generated, but when I try to use it to access the blob store, the API responds with a BadRequest:

Not Found. There was no storage account called '<storage_account_name>' in the Azure region 'West Europe'.

These commands used to work just fine. Did something change in the way I should generate a valid sas token?

Thank you for your help!

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,920 questions
{count} votes

Accepted answer
  1. Nehruji R 8,146 Reputation points Microsoft Vendor
    2024-10-16T08:25:50+00:00

    Hello Akker, Sander van den,

    Greetings! Welcome to Microsoft Q&A Platform.

    Based on the error message it indicates that the specified storage account does not exist. Ensure that the storage account name is correct and that it exists in the specified region by listing the storage accounts in the particular resource group and verify it,

    To list the storage accounts in a resource group on Azure, you can use the Azure CLI,

    Open your terminal or command prompt.

    Log in to your Azure account using the command:

    az login
    
    

    List the storage accounts in a specific resource group using the following command:

    az storage account list --resource-group <resource-group-name>
    
    

    Replace <resource-group-name> with the name of your resource group.

    • Please ensure the storage account exists in the resource group
    • 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?
    • Also please check if any outages are updated in Azure Status Page for WE region which may cause intermittent failures in connecting to storage account.

    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

    Hope this helps! please let us know if you have any further queries. I’m happy to assist you further.


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

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.