New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As a corporate customer, I would like CVRF downloads to occur via Proxy #5
Comments
Good suggestion, Xeleema. The commands in this module are really just wrappers over Invoke-RestMethod (https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/invoke-restmethod) which has parameters to support using a Proxy. As a workaround, you could do this: Import-Module MsrcSecurityUpdates
Set-MSRCApiKey -ApiKey Foo
### Get a CVRF document using Proxy Credentials
$apiUrl = "$msrcApiUrl/cvrf/2017-Apr?$msrcApiVersion"
Invoke-RestMethod -Method Get -Uri $apiUrl -Headers @{
'Api-Key' = $global:MSRCApiKey
'Accept' = 'application/json'
} -Proxy http://myProxy -ProxyCredential (Get-Credential -Message 'Please enter the creds for the proxy' -UserName MyProxyUserName)
### Get security Updates using Proxy Credentials
$apiUrl = "$msrcApiUrl/updates?$msrcApiVersion"
Invoke-RestMethod -Method Get -Uri $apiUrl -Headers @{
'Api-Key' = $global:MSRCApiKey
'Accept' = 'application/json'
} -Proxy http://myProxy -ProxyCredential (Get-Credential -Message 'Please enter the creds for the proxy' -UserName MyProxyUserName) |
Select-Object -ExpandProperty Value``` |
You could also set the proxy as devault values like this: |
That's a great workaround, thanks for the suggestion! Given that the workaround exists, I don't think we should plumb the parameters through to the Get-Msrc* commands. |
Fixed by @NicholasBn in #10 |
Digging into $Error shows Invoke-RestMethod caught an "Access Denied (authentication_failed)" from the proxy. So something isn't quite right with $PSDefaultParameterValues (or $global:PSDefaultParameterValues, even when specifying 'Invoke-RestMethod instead of '*'). I'll grab 1.6.6 and give that a shot. :) Edit: $PSDefaultParameterValues suggestion works, then things trip and stumble when Get-MsrccvrfDocument calls Get-CVRFID. |
Moved comment to Issue #9 |
Have you tried using Set-MSRCApiKey with the Proxy and ProxyCredential parameters? Set-MSRCApiKey -ApiKey foo -Proxy http://myProxy -ProxyCredential (Get-Credential) |
@craig-martin Yes, I tried the new parameters. Works as good as or as bad as setting $PSDefaultParameterValues. |
Thanks for the extra detail. Can you try using Invoke-RestMethod on its own? This module is basically a wrapper over that command so I'd like to confirm that it works. Here is a sample command line without proxy details: Invoke-RestMethod -Uri https://api.msrc.microsoft.com/cvrf/2016-Sep?api-Version=2016 -Headers @{'Api-Key'='YOUR KEY GOES HERE';Accept='application/json'} Here is a sample command line with proxy details: Invoke-RestMethod -Uri https://api.msrc.microsoft.com/cvrf/2016-Sep?api-Version=2016 -Headers @{'Api-Key'='YOUR KEY GOES HERE';Accept='application/json'} -Proxy http://YourProxyServer -ProxyCredential (Get-Credential) |
@craig-martin
When I dot-source and call Get-CVRFID directly, I'm able to get data through our proxy;
However, I catch an error when running ;
The run of Every call to Invoke-RestMethod is affected. NOTE: However, this was as it stood on May 11th with version 1.6.7. I'll upgrade to PowerShell v5.0 and grab the latest *.zip file blob. |
Update: Since there doesn't appear to be an applicable code-change since May 11th, I've dug deeper and discovered the following; Within Regarding the if-statement for Remove this;
Then incorporate it into the if-statement for
Note the "if no
|
We have run into the same issue at our corporation. We need to access this data via proxy (MiM) that is required for our govt customer base. |
Merge pull request #77 from p0w3rsh3ll/master
Within a corporate environment, where servers are restricted from accessing the internet, the cmdlets should have "out-of-the-box" support for specifying Proxy settings.
Text-based Error
The text was updated successfully, but these errors were encountered: