title: Could not establish trust relationship for the SSL/TLS secure channel when downloading file via Powershell DSC
body: <p>I'm trying to download a file via by invoking a web request inside a Powershell DSC.</p>
  
  <p>When i execute the script i get the error</p>
  
  <pre><code>PowerShell DSC resource MSFT_ScriptResource  failed to execute Set-
  TargetResource functionality
  with error message: The underlying connection was closed: Could not 
  establish trust relationship for the SSL/TLS secure channel.
  </code></pre>
  
  <p>If i invoke the web request with the same headers and proxy outside of DSC, the request succeeds. What can i do to make the request work inside DSC?</p>
  
  <pre><code>Script DownloadArtifact{
  
          GetScript = 
          {
             Result = ('True' -in (Test-Path -Path "C:\Temp\BuildPackage\MyAPI.zip"))
          }
          SetScript = {
  
                 $outfile = "C:\Temp\BuildPackage\MyAPI.zip"
  
                  $headers = @{"Authorization"="Basic &lt;redacted&gt;"}
  
                  $uri = "https://mycompany.visualstudio.com/_apis/build/builds/10374/artifacts/?artifactName=MyAPI&amp;%24format=zip"
  
                  Invoke-WebRequest -Uri $uri -OutFile $outfile -Headers $headers -Proxy "http://proxy:8080"
  
                  Unblock-File -Path $outfile;
              }
              TestScript = 
              {
                  Test-Path -Path "C:\Temp\BuildPackage\MyAPI.zip"
              }           
      }
  </code></pre>
  
  <p>Incidentally i get the same error when using <code>[xRemoteFile]</code> too.</p>