Microsoft.Azure.Commands.Batch.Models.BatchClient.ListAccounts C# (CSharp) Method

ListAccounts() public method

Lists all accounts in a subscription or in a resource group if its name is specified
public ListAccounts ( Hashtable tag, string resourceGroupName = default(string) ) : IEnumerable
tag Hashtable The tag to filter accounts on
resourceGroupName string The name of the resource group to search under for accounts. If unspecified, all accounts will be looked up.
return IEnumerable
        public virtual IEnumerable<BatchAccountContext> ListAccounts(Hashtable tag, string resourceGroupName = default(string))
        {
            // no account name so we're doing some sort of list. If no resource group, then list all accounts under the
            // subscription otherwise all accounts in the resource group.
            var response = string.IsNullOrEmpty(resourceGroupName)
                ? BatchManagementClient.BatchAccount.List()
                : BatchManagementClient.BatchAccount.ListByResourceGroup(resourceGroupName);

            var batchAccountContexts =
                ListAllAccounts(response).
                Where(acct => Helpers.MatchesTag(acct, tag)).
                Select(resource => BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource));

            return batchAccountContexts;
        }
BatchClient