Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
179 stars 128 forks source link

Support 'UseDevelopmentStorage=true' #4938

Open twhiting opened 1 year ago

twhiting commented 1 year ago

Is your feature request related to a problem? Please describe.

I'm working to upgrade our team from the old azure storage cpp libraries since it has been EOL'd. One issue adopting this new sdk is that it doesn't appear to support the 'UseDevelopmentStorage=true' connection string.

I find this feature really useful and i'm sure this work would unblock others looking to adopt this new sdk.

Describe the solution you'd like

Support the legacy 'usedevelopmentstorage=true' configuration for connection strings.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

Jinming-Hu commented 1 year ago

Hi @twhiting , usedevelopmentstorage=true is just an alias of storage account for Azurite emulator, you can use below code instead. They are equivalent.

auto credential = std::make_shared<Azure::Storage::StorageSharedKeyCredential>(
      "devstoreaccount1",
      "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==");
auto serviceClient = BlobServiceClient("http://127.0.0.1:10000", credential);
twhiting commented 1 year ago

@Jinming-Hu hi!

I understand these are equivalent, but it did take me quite a while to understand. I'm sure that others will run into this problem like I did when upgrading from the old azure-storage-cpp sdk (https://github.com/Azure/azure-storage-cpp)

  1. Straight upgrade from the old deprecated sdk will not work, as the UseDevelopmentStorage=true alias does not work for this sdk. This is not immediately apparent anywhere.
  2. Azurite docs show a C# example where it is implied that UseDevelopmentStorage=true works with a BlobContainerClient. https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#configure-a-connection-string-for-azurite
  3. It appears that this is fragmented between the various versions of the SDKs, C# sdk supports it, C++ does not, Python wants it, Rust has it, etc.
Jinming-Hu commented 1 year ago

Thanks for your feedback. We'll consider adding it.

Before it's available in C++ SDK, you could use the equivalent code above to unblock yourself.

twhiting commented 1 year ago

Sounds good, thanks!