I have an Azure storage connection string and from which I want to read AccountName and Account Key .
I could get the account Name but not the key .
Can anyone suggest me how to read Key ?
ConnectionString : DefaultEndpointsProtocol=https;AccountName=dev;AccountKey=tsdsgyduysaugdsay4aR6EPn2Ie9YOILeEp5RRFXeeaJ9;EndpointSuffix=core.windows.net
var cloudStorageAccount = CloudStorageAccount.Parse(ConnectionString);
var storageCredentials = new StorageCredentials(cloudStorageAccount.Credentials.AccountName, cloudStorageAccount.Credentials.KeyName);
So if you have storage credentials (account name and key) and the blob's URI, there're two ways to create an instance of CloudBlockBlob.
var storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key;EndpointSuffix=core.windows.net;");
var blob = new CloudBlockBlob(new Uri("https://account-name.blob.core.windows.net/container-name/blob-name"), storageAccount.Credentials);
OR
var storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key;EndpointSuffix=core.windows.net;");
var blobClient = storageAccount.CreateCloudBlobClient();
var blob = new CloudBlockBlob(new Uri("https://account-name.blob.core.windows.net/container-name/blob-name"), blobClient);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.