Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
$server_url = $args[0]
$api_key = $args[1]
$date_str = Get-Date -Format "yyMMddhhmmss"
$date_header = Get-Date -Format "ddd, dd MMM yyyy hh:mm:ss zzz"
$results_table = curl -Method Get https://$server_url.applitools.com/api/sessions/renderinfo?apiKey=$api_key | ConvertFrom-Json
$put_url = $results_table.resultsUrl.Replace("__random__", $date_str)
Write-Host "Testing PUT to:"
Write-Host $put_url
$put_results = curl -Method Put -Body "" -Headers @{'x-ms-date' = "$date_header"; 'x-ms-blob-type' = 'BlockBlob';'x-ms-version' = '2015-02-21'} "$put_url"
Write-Host $put_results.StatusCode $put_results.StatusDescription
@SophieDePaula

This comment has been minimized.

Copy link

SophieDePaula commented Mar 10, 2020

  1. Download the script above.
  2. Run script in a Powershell Window with Applitools subdomain (i.e. mycompanyeyes) and working API Execute Key (same key that runs tests)
    e.g. .\windows.ps1 “mycompanyeyes" “APPLITOOLS_API_KEY"
  3. If the final output responds with a 201, then no additional whitelisting is necessary.
  4. If the final output responds with a 4XX error, you will need to whitelist the domain after the printed line "Testing PUT to:”
    e.g. Testing PUT to: https://mycompanyeyes.blob.core.windows.net/temp/blabla?sv=xxxxxxx&sr=xxx&sig=xxxxxxxx&se=xxxxx&sp=xx&accessKey=xxxxxx
    means you need to whitelist mycompanyeyes.blob.core.windows.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.