Download blob using SAS url in (java sdk v12)

Neharika Singh 11 Reputation points
2022-08-11T22:51:24.33+00:00

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.

230652-image.png

230616-image.png

@

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
    2022-08-15T15:59:12.753+00:00

    @SaiKishor-MSFT
    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
    2022-08-11T23:13:09.087+00:00

    @Neharika Singh Thank you for reaching out to Microsoft Q&A. Please refer to this similar thread- https://stackoverflow.com/questions/25038429/azure-shared-access-signature-signature-did-not-match

    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!
    Remember:

    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
    2022-08-12T13:57:37.063+00:00

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

    230766-image.png


  4. Neharika Singh 11 Reputation points
    2022-08-12T20:09:23.047+00:00

    @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