FunctionsPublic/Get-ProxsysGraphAllUsers.ps1

<#
.SYNOPSIS
Get all users
 
.DESCRIPTION
Lists all users that are configured in the customers tenant
#>

function Get-ProxsysGraphAllUsers
{
    [cmdletbinding()]
    param(
        [psobject]$accessToken,
        [string]$tenantID
    )

    $requestBody = @{
    "query" = "query GetAllTenants { tenants { id, name }}"
        }

    $responseBody = Invoke-RestMethod `
        -Uri "https://graph.proxsys.dev"  `
        -Headers @{
            "Authorization" = "Bearer $($accesstoken.AccessTokenCredential.GetNetworkCredential().password)";
            "X-Tenant-Id" = "$($tenantID)"
        } `
        -Body $requestBody `
        -ContentType "application/json"

    return $responseBody.data
}x