-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[FEATURE REQ] Make the process of using a CustomerProvidedKey with BlobClient more DI-friendly #20233
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage. Issue DetailsLibrary or service name. Is your feature request related to a problem? Please describe. You can inject
So what you end up with is a situation where your DI-injected For my specific use-case, we generate new encryption keys for each new blob we upload, so I've basically ended up creating a If there were an extra overload of
|
Hi, Just to be clear |
No, not on As for how to handle the |
@tg-msft, @KrzysztofCwalina, what do you think of this idea? For Blobs, this would entail the following new overloads:
We would also make this change in Data Lake, SMB Files, and Queues. Any client options that aren't null would override the options on the parent client in the newly created client. |
No, we can't take new |
@bkromhout, would this solution above work for you? |
Sounds great to me! |
Ok, I will work on this this week. |
@tg-msft, just want to double check, we are cool with:
We could also consider adding |
@bkromhout, I added |
Awesome, thanks for the quick work! When do you expect it to be out in stable, roughly? |
Library or service name.
Azure.Storage.Blobs
Is your feature request related to a problem? Please describe.
Currently, the process of setting up a
BlobClient
instance to use aCustomerProvidedKey
in projects that leverage DI (e.g., and ASP.NET Core project) is very annoying.You can inject
BlobServiceClient
via DI, and obviously you can createBlobContainerClient
s andBlobClient
s using the injectedBlobServiceClient
instance. That's great for normal usage...but as soon as I need to create aBlobClient
that uses aCustomerProvidedKey
, it becomes frustrating, because:CustomerProvidedKey
must be passed viaBlobClientOptions
BlobClientOptions
toBlobClient
is via its constructors, there's no other way via the "normal"BlobServiceClient
->BlobContainerClient
->BlobClient
route.BlobServiceClient
and pass to theBlobClient
constructor to let me "inherit" the identity, URI, etc in that fashion.So what you end up with is a situation where your DI-injected
BlobServiceClient
becomes useless, and you have to inject all of the information needed to set up a brand newBlobClient
instance usingIOptions<Foo>
(or something similar).For my specific use-case, we generate new encryption keys for each new blob we upload, so I've basically ended up creating a
BlobClient
factory and inject that via DI, but it would really be preferable if there were some way to just create theBlobClient
viaBlobServiceClient
I'm already injecting for other reasons.If there were an extra overload of
BlobContainerClient.GetBlobClient()
that took a second parameter of typeBlobClientOptions
(or perhaps simplyCustomerProvidedKey
), that would be excellent.The text was updated successfully, but these errors were encountered: