Public/Connect-Pegasus.ps1

<#
.SYNOPSIS
Connects to the Inbound Provisioning API using the specified credentials. The credentials are stored in the script scope and used for all subsequent calls to the API.

.EXAMPLE
$Credential = Get-Credential
Connect-Pegasus -ClientSecretCredential $Credential -TenantId "00000000-0000-0000-0000-000000000000"

#>

function Connect-Pegasus {
    [CmdletBinding(DefaultParameterSetName = "clientsecret")]

    Param
    (
        [Parameter(Mandatory = $true)]
        [String] $APIRoot,

        [Parameter(Mandatory = $false)]
        [String] $EntraIDAccessTokenProfile = "Pegasus"
    )
    
    Process {
        $Script:APIRoot = $APIRoot
        $Script:EntraIDAccessTokenProfile = $EntraIDAccessTokenProfile
        
        Get-EntraIDAccessToken -Profile $EntraIDAccessTokenProfile | Out-Null
    }
}