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

GetSubscriptionAccount() private method

private GetSubscriptionAccount ( System.Guid subscriptionId ) : AzureAccount
subscriptionId System.Guid
return Microsoft.Azure.Commands.Common.Authentication.Models.AzureAccount
        private AzureAccount GetSubscriptionAccount(Guid subscriptionId)
        {
            List<AzureAccount> accounts = ListSubscriptionAccounts(subscriptionId);
            AzureAccount account = accounts.FirstOrDefault(a => a.Type != AzureAccount.AccountType.Certificate);

            if (account != null)
            {
                // Found a non-certificate account.
                return account;
            }

            // Use certificate account if its there.
            account = accounts.FirstOrDefault();

            return account;
        }