Microsoft.Azure.ServiceManagemenet.Common.ProfileClient.ListSubscriptionsFromServerForAllAccounts C# (CSharp) Method

ListSubscriptionsFromServerForAllAccounts() private method

private ListSubscriptionsFromServerForAllAccounts ( AzureEnvironment environment ) : IEnumerable
environment Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment
return IEnumerable
        private IEnumerable<AzureSubscription> ListSubscriptionsFromServerForAllAccounts(AzureEnvironment environment)
        {
            // Get all AD accounts and iterate
            var accountNames = Profile.Accounts.Keys;

            List<AzureSubscription> subscriptions = new List<AzureSubscription>();

            foreach (var accountName in accountNames.ToArray())
            {
                var account = Profile.Accounts[accountName];

                if (account.Type != AzureAccount.AccountType.Certificate)
                {
                    subscriptions.AddRange(ListSubscriptionsFromServer(account, environment, null, ShowDialog.Never));
                }

                AddOrSetAccount(account);
            }

            if (subscriptions.Any())
            {
                return subscriptions;
            }
            else
            {
                return new AzureSubscription[0];
            }
        }