Hello Shivam Agarwal,
Greetings! Welcome to Microsoft Q&A Platform.
The error message you’re encountering indicates an authorization failure when using StorageSharedKeyCredential or a SAS token with Azure Blob Storage. Please consider the following steps to troubleshoot this issue:
If you’re using a StorageSharedKeyCredential, compare the string to sign with the one generated by the SDK. You can log the string to sign by passing the context key-value pair Azure-Storage-Log-String-To-Sign: true to the appropriate method call.
Similarly, if you’re using a SAS token, compare the string to sign with the one generated by the SDK. To log the string to sign, use Azure-Storage-Log-String-To-Sign: true with the appropriate generateSas method call.
Ensure that you’ve correctly set up your BlobServiceClientBuilder with the right credentials (either StorageSharedKeyCredential or SAS token) and the correct endpoint (in the format https://{accountName}.blob.core.windows.net).
Double-check that your credentials are valid and have the necessary permissions to perform the desired operation.
If you’re using an SAS token, consider creating an Account SAS in the Azure Portal. This token provides granular access control and can be generated for specific containers or blobs.
Make sure the SAS token is correctly formatted and includes the required permissions (e.g., read, write, list) and please check if you provided the storage blob data contributor access.
Verify that the authorization policies (e.g., CORS rules, firewall rules) for your storage account allow the requested operation. Check if there are any IP restrictions or network rules that might be blocking access.
Check if you have enabled the "Allow trusted Microsoft services to access this storage account**"** allows you to access storage account refer article.
reference - https://video2.skills-academy.com/en-us/dotnet/api/azure.storage.blobs.blobserviceclient.-ctor?view=azure-dotnet, https://stackoverflow.com/questions/76899527/authenticationerror-when-accessing-azure-blobserviceclient-in-java-app, https://video2.skills-academy.com/en-us/java/api/com.azure.storage.blob.blobserviceclientbuilder?view=azure-java-stable,
Hope this answer 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.