Download blob using SAS url in (java sdk v12)

Neharika Singh 11 Reputation points

In current application, input data are pushed to blob storage. As soon as files arrived pipeline is trigger to process it. After processing the input files, output files are again dumped into storage as blob. we need to notify users via email. The email should contain with link to output files, so that they can click on the link and output files would be downloaded.

I am trying to generate SAS url programmatically , but when using this SAS url it gives me authentication error.

Please find the snippet and let me know what am i missing here, I cannot find lot of example or documentation around it.




Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,671 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Neharika Singh 11 Reputation points

    I was finally able to resolve it by passing context object as show below:

    Context c = new Context("Azure-Storage-Log-String-To-Sign", true);
    String sas = blobClient.generateSas(serviceSasValues1, c);

    Rest of the code remains the same.

    2 people found this answer helpful.

  2. SaiKishor-MSFT 17,181 Reputation points

    @Neharika Singh Thank you for reaching out to Microsoft Q&A. Please refer to this similar thread-

    Add comp=list&restype=container to your SAS URL and you should not get this error. Can you please try this and let us know if this helps? Thanks!

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    Want a reminder to come back and check responses? Here is how to subscribe to a notification.

    0 comments No comments

  3. Neharika Singh 11 Reputation points

    @SaiKishor-MSFT I have tried comp=list&restype=container as well in the URL, however I am getting another error.


  4. Neharika Singh 11 Reputation points

    @SaiKishor-MSFT I could generate SAS URL from azure portal and I was able to download the output files. I don't think firewall is an issue.

    0 comments No comments