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] CloudStorageAccount equivalent in Storage v12 #12892

Closed
SeanFeldman opened this issue Jun 19, 2020 · 11 comments
Closed

[QUERY] CloudStorageAccount equivalent in Storage v12 #12892

SeanFeldman opened this issue Jun 19, 2020 · 11 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. 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

@SeanFeldman
Copy link
Contributor

Query/Question

With Storage v11 there was a CloudStorageAccount type that could be constructed by parsing a connection string, SAS Uri, or taking an instance of StorageCredentials. In addition to that, CloudStorageAccount would be able to return a StorageCredentials object, allowing a common way of generating storage credentials from one of the provided options above.

With v12 this doesn't seem to be possible anymore. What the equivalent and where can I find some examples?

Environment:

  • Name and version of the Library package used: [e.g. Azure.Storage.Blobs 12.2.0]
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): [e.g. Azure AppService or Windows 10 .NET Framework 4.8]
  • IDE and version : [e.g. Visual Studio 16.3]
@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 19, 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 19, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 19, 2020
@ghost
Copy link

ghost commented Jun 19, 2020

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

@seanmcc-msft
Copy link
Member

V12 doesn't have the equivalent of a CloudStorageAccount.

Here's our authentication samples for blob - https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blobs/samples/Sample02_Auth.cs

@seanmcc-msft seanmcc-msft removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 19, 2020
@seanmcc-msft seanmcc-msft self-assigned this Jun 19, 2020
@jsquire jsquire added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Jun 20, 2020
@SeanFeldman
Copy link
Contributor Author

@seanmcc-msft, thank you. The issue is not how to authenticate but how to get the parts from the authentication information. For example, CloudStorageAccount had a BlobEndpoint property. What would be the way to get this information in v12?

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Jun 22, 2020
@seanmcc-msft
Copy link
Member

BlobServiceClient.Uri is probably the closes equivalent. It will give you your primary blob endpoint.

@seanmcc-msft seanmcc-msft removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 22, 2020
@SeanFeldman
Copy link
Contributor Author

The transition from v11 to v12 is a very poor experience 🙁
I realize it's not always possible to obsolete with errors, things should be documented and a migration guide created to answer these sorts of questions.

Thank you for your help, @seanmcc-msft.

@amishra-dev
Copy link
Contributor

Thanks for the feedback @SeanFeldman. We are working on the migration guide.

@tonygomez
Copy link

tonygomez commented Nov 5, 2020

I was looking for the parse method found on CloudStorageAccount

use case:
I have a connection string to up/download files
I need the account name and key to create a sas token

I now need three app setting properties? connection string, account name, and key? Yes, I could create my own connection string build or parser but it would be nice to have this util in the sdk. Maybe I am missing something in in the api?

@denniselit
Copy link

I was looking for the parse method found on CloudStorageAccount

use case:
I have a connection string to up/download files
I need the account name and key to create a sas token

I now need three app setting properties? connection string, account name, and key? Yes, I could create my own connection string build or parser but it would be nice to have this util in the sdk. Maybe I am missing something in in the api?

Could someone answer this? @SeanFeldman you maybe?

@SeanFeldman
Copy link
Contributor Author

Sorry mate, I have given up on this one. @azure-sdk has decided to enforce the model where the user code has to decide what authentication mode is used and call the appropriate API, unlike the approach taken with CloudStorageAccount in the past.

@RobertoPrevato
Copy link

I resigned to using a simple regular expression to obtain account key and name from the connection string, example:

try
{
    var matches = Regex.Matches(connectionString, @"([^=]+)=([^\;]+);?");
    var parts = matches.ToDictionary(value => value.Groups[1].ToString(), value => value.Groups[2].ToString());

    var key = parts["AccountKey"];
    var name = parts["AccountName"];
}
catch (KeyNotFoundException)
{
    throw new ArgumentException("Invalid connection string");
}

@kzu
Copy link
Contributor

kzu commented Apr 26, 2022

I just brought it back and now everything is 💯 : https://www.nuget.org/packages/Devlooped.CloudStorageAccount

@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. 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

8 participants