protected string GetStorageKey(string storageName)
{
string storageKey = string.Empty;
if (!string.IsNullOrEmpty(storageName))
{
var storageClient = AzureSession.ClientFactory.CreateArmClient<StorageManagementClient>(DefaultProfile.Context,
AzureEnvironment.Endpoint.ResourceManager);
var storageAccount = storageClient.StorageAccounts.GetProperties(this.ResourceGroupName, storageName);
if (storageAccount != null)
{
var keys = storageClient.StorageAccounts.ListKeys(this.ResourceGroupName, storageName);
if (keys != null)
{
storageKey = !string.IsNullOrEmpty(keys.Key1) ? keys.Key1 : keys.Key2;
}
}
}
return storageKey;
}