Connect-AtriaApi
SYNOPSIS
Establishes a connection to the Atria API using an authentication token.
SYNTAX
Connect-AtriaApi [-AuthToken] <String> [[-apiBase] <String>] [<CommonParameters>]
DESCRIPTION
Calls /v2/me to validate the token, then stores the token, API base URL, user identity, and roles in the module's script scope for later cmdlets.
PARAMETERS
-
AuthToken
<String>(Required) A bearer API token generated in Atria. -
apiBase
<String>(Optional) The base URL of the Atria API. If omitted, the function uses the default URL provided by theGet-AtriaApiUrlBasefunction appended with/api. -
<CommonParameters>Supports common parameters:Verbose,Debug,ErrorAction,ErrorVariable,WarningAction,WarningVariable,OutBuffer,PipelineVariable, andOutVariable.More info: about_CommonParameters.
The current module writes the token to its internal verbose stream. Do not call Connect-AtriaApi with -Verbose, and do not capture verbose output from this command in automation logs.
The module retains the token in memory until Disconnect-AtriaApi is called or the PowerShell process ends.
EXAMPLES
Example 1
$secureToken = Read-Host 'Atria API token' -AsSecureString
$token = [Net.NetworkCredential]::new('', $secureToken).Password
Connect-AtriaApi -AuthToken $token
Remove-Variable token
Connects to the Atria API with the provided authentication token, using the default API URL.
Example 2
$secureToken = Read-Host 'Atria API token' -AsSecureString
$token = [Net.NetworkCredential]::new('', $secureToken).Password
Connect-AtriaApi -AuthToken $token -apiBase 'https://atria.example.com/api'
Remove-Variable token
Connects to an explicitly selected Atria API base URL. Include /api but not a versioned route such as /v2.