Getting a 'BlobNotFound' Error After Accessing a Blob Document Using a Valid URI

Yan Cahila 0 Reputation points
2024-01-11T09:01:40.8466667+00:00

I'm trying to access a blob document via a URI and I'm getting this issue,

User's image

So the url is in this format,

url = 'https://'+account_name+'.blob.core.windows.net/'+container_name+'/'+blob_name+'?'+blob
print(url)

The blob variable has both the blob name and the sas token.

Appreciate the help I'll be getting from the community.

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

2 answers

Sort by: Most helpful
  1. Luis Arias 4,871 Reputation points
    2024-01-11T12:03:36.64+00:00

    Hi Yan,

    If your blob variable is a concatenation of blob_name and sas_token , there is the mistake . The format right next to ? is the sas_token value. Example:

    https://<storage_name>.blob.core.windows.net/<container_name>/<blob_name>?<sas_token>
    
    #only to validate if you are getting the sas token
    sas_token format: sp=r&st=<date_initial>&se=date_final:56Z&sv=<version>&sr=b&sig=<signature>
    

    If the error still present you can check, here a few things you could check:

    1. Blob Name: Ensure that the blob_name is correct and exists in the specified container.
    2. Container Name and Account Name: Verify that the container_name and account_name are accurate.
    3. Check if the SAS token has the necessary permissions and is valid
    4. Access Level: If you’re trying to access the blob directly via a browser, you might need to change the access level of your container.

    Let me know if this solve your problem. Luis


    If the information helped address your question, please Accept the answer

    0 comments No comments

  2. Sumarigo-MSFT 43,801 Reputation points Microsoft Employee
    2024-04-23T05:26:24.29+00:00

    @Yan Cahila Adding more information to the above response!

    You might get a "BlobNotFound" error if the blob name is incorrect, the container name or account name is inaccurate, or the SAS token is invalid or doesn't have the necessary permissions. You can also try these steps:

    • Check the blob name: Make sure the blob name is correct and exists in the specified container
    • Check the container name and account name: Verify that the container name and account name are accurate
    • Check the access level: If you're trying to access the blob directly via a browser, you might need to change the access level of your container
    • Check for spaces: If the name of your blob contains spaces, the URL might have %2520 instead of the spaces 

    Please try attaching a SAS token with appropriate permissions to the copy source url. There is a recent GitHub thread where a user faced the same issue.

    Option 2 :

    You can authorize access to blob data via the Azure portal, PowerShell, or Azure CLI by using the user's Microsoft Entra account or by using the account access keys (Shared Key authorization). However, authorization with Shared Key is not recommended as it may be less secure. 

    You can view a blob container's contents by:

    1. Opening Storage Explorer
    2. Expanding the storage account containing the blob container you wish to view in the left pane
    3. Expanding the storage account's Blob Containers
    4. Right-clicking the blob container you wish to view, and from the context menu, select Open Blob Container Editor 

    Azure Blob Storage error codes

    Azure provides the following Azure built-in roles for authorizing access to blob and queue data using Azure AD and OAuth: For more information See here

    Additional information: Authorizing access to data in Azure Storage

    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