Connect-Cloud.ps1
function Connect-Cloud { param( [Parameter(Mandatory)] [string] $CloudUrl, [PSCredential] $Credential = $(Get-Credential -Message "Enter your Apprenda credentials."), [string] $AppAlias = "soc" ) $Script:CloudUrl = New-Object Uri $CloudUrl try { $Script:Headers = @{} $Script:AppAlias = $AppAlias $response = Register-Session $Credential $AppAlias $Script:Headers["ApprendaSessionToken"] = $response.ApprendaSessionToken return $response } catch { $Script:Headers = $null $Script:AppAlias = $null throw } } |