private static string GetDefaultStorage(string storageName, string locName) { Collection <StorageServicePropertiesOperationContext> storageAccounts = vmPowershellCmdlets.GetAzureStorageAccount(null); foreach (var storageAccount in storageAccounts) { if (storageAccount.StorageAccountName == storageName) { return(storageAccount.StorageAccountName); } } var account = vmPowershellCmdlets.NewAzureStorageAccount(storageName, locName); if (account.StorageAccountName == storageName) { return(account.StorageAccountName); } return(null); }