public async Task <UserCollection> GetUsersFromAPIM() { string oldNextLink = ""; UserCollection users = await GetApiManagementUsersAsync(APIMSubscriptionId, APIMResourceGroup, APIMServiceName); while (users.nextLink != null) { if (oldNextLink == users.nextLink) { break; } // since the request is limited to 100 users, this will get the next list of users and add them. UserCollection nextUsers = await GetApiManagementUsersAsync(APIMSubscriptionId, APIMResourceGroup, APIMServiceName, users.nextLink); foreach (var user in nextUsers.value) { users.AddUserContract(user); } oldNextLink = users.nextLink; } return(users); }