Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUERY] Azure.Storage.Blobs: How to generate SAS URL for a blob when using storage emulator #12790

Closed
yasufs opened this issue Jun 16, 2020 · 3 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@yasufs
Copy link

yasufs commented Jun 16, 2020

Query/Question
How do I generate a SAS URL for a blob when using the storage emulator (UseDevelopmentStorage=true)?
When using a real storage account, I can use BlobSasBuilder + StorageSharedKeyCredential, but I couldn't find a good way to get a StorageSharedKeyCredential to use with the storage emulator.
I know there is a well-known account name & key for the emulator, but it would be really ugly to have to hardcode these into the application code. I think these are exist as constants in the SDK, but hidden inside internal classes.

Environment:

  • Azure.Storage.Blobs 12.4.4
  • Windows 10 .NET Core 3.1
  • Visual Studio 16.6.2
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 16, 2020
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Jun 16, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 16, 2020
@ghost
Copy link

ghost commented Jun 16, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

@amnguye amnguye self-assigned this Jun 16, 2020
@amnguye
Copy link
Member

amnguye commented Jun 16, 2020

Hi,

Are you asking for us to expose these credentials?

Unfortunately I don't think we can expose these constants. Sorry for the inconvenience.

Please reactivate if I missed the mark on answering your question.

@amnguye amnguye closed this as completed Jun 16, 2020
@yasufs
Copy link
Author

yasufs commented Jun 17, 2020

With the old Microsoft.WindowsAzure.Storage SDK I could do something like:

var account = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
var sasQueryString = account.CreateCloudBlobClient()
                            .GetContainerReference(container)
                            .GetBlockBlobReference(blob)
                            .GetSharedAccessSignature(policy);

to get a SAS token for a blob. I was just wondering what is the recommended way to do this with the latest Azure.Storage.Blobs SDK.
If there is simply no way to do it without hardcoding, then you can just tell me that and I'll go ahead with the hardcoding.

It would nice to have a nicer way to do that though... for example, if #12414 is addressed then that would solve my issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

3 participants