public List<StorageAccount> GetStorageAccountList() { var getStorageAccountList = new ListStorageAccountsCommand { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; getStorageAccountList.Execute(); return getStorageAccountList.StorageAccounts; }
/// <summary> /// Gets a list of storage accounts from the storage catalog /// </summary> List<StorageAccount> IStorageActivity.GetStorageAccountList(bool includeKeys) { var getStorageAccountList = new ListStorageAccountsCommand { SubscriptionId = Manager.SubscriptionId, Certificate = Manager.ManagementCertificate }; getStorageAccountList.Execute(); if(!includeKeys) return getStorageAccountList.StorageAccounts; // if the get keys flag is supplied then ensure that this returns the keys with the structure foreach (var storageAccount in getStorageAccountList.StorageAccounts) { var keys = new GetStorageAccountKeysCommand(storageAccount.Name) { SubscriptionId = Manager.SubscriptionId, Certificate = Manager.ManagementCertificate }; keys.Execute(); storageAccount.PrimaryAccessKey = keys.PrimaryStorageKey; storageAccount.SecondaryAccessKey = keys.SecondaryStorageKey; } return getStorageAccountList.StorageAccounts; }