Public/Connect-SarakeSignPS.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
function Connect-SarakeSignPS { [CmdletBinding()] param ( # Site information as PSCredential [Parameter(Mandatory=$true)] [pscredential] $siteCred ) begin { $script:siteinfo.url = ($siteCred.GetNetworkCredential().UserName).TrimEnd('/') Write-Verbose "Connect-SarakeSignPS: url: $($script:siteinfo.url)" } process { try{ $apikey = $siteCred.GetNetworkCredential().Password Write-Debug "Connect-SarakeSignPS: apikey: $apikey" $token = Get-BearerToken -apikey $apikey Write-Debug "Got token: $token" $script:siteinfo.token = $token } catch { throw "Cannot connect to to site" } } end { } } |