FunctionsPublic/Get-ProxsysGraphAllTenants.ps1

<#
.SYNOPSIS
Get all tenants
 
.DESCRIPTION
Lists all tenants that are configured within the CDI
#>

function Get-ProxsysGraphAllTenants
{
    [cmdletbinding()]
    param(
        [psobject]$accessToken
    )

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

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

    return $responseBody.data.tenants
}