Functions/Get-AllExchangeOnlineUsers.ps1

<#
.SYNOPSIS
    This function retrieves all the users present on Exchange Online.
.DESCRIPTION
    This function retrieves all the users present on Exchange Online.
    If the environment is set as not testing (production), it retrieves the users directly from
    Exchange Online.
    Otherwise, it retrieves the list of users in the test environment instead.
#>

function Get-AllExchangeOnlineUsers {
    # The environment is set to testing
    if ((Get-BT_RunbookEnvironment).IsTestEnvironment) {
        return Get-Office365TestEnvironmentAvailableUsers -TestID $Global:Office365TestRunID -ExchangeOnline
    }

    # The environment is not set to testing
    else {
        return Get-User -ResultSize unlimited
    }
}