microsoft/SdnDiagnostics

Enable support for X509 Certificate Authentication

Closed this issue · 0 comments

Need to enable support for passing a x509 certificate to authenticate against the REST API for Network Controller.

In reviewing Invoke-WebRequest and Invoke-RestMethod, there are two parameters that are most commonly used for this.

  • -CertificateThumbprint: This allows you to specify a thumbprint string. It will look for the certificate under cert:\currentuser.
  • -Certificate: This enables you to pass an X509 parameter. You typically assign this to variable such as $cert = Get-Item -Path cert:\LocalMachine\My\{thumbprint} and then pass to Invoke-RestMethod -Certificate $cert

Taking the above into effect, -Certificate appears to be more beneficial to implement.