Enable-VdaSSL.ps1 Error "Unable to Access the Private Key of the Certificate or One of Its Fields"

Enable-VdaSSL.ps1 Error "Unable to Access the Private Key of the Certificate or One of Its Fields"

book

Article ID: CTX477522

calendar_today

Updated On:

Description

To enable SSL for VDA, Error "Unable to Access the Private Key of the Certificate or One of Its Fields" is thrown While run Enable-VdaSSL.ps1 script

Resolution

Specify “Microsoft Enhanced RSA and AES Cryptographic Provider” as provider in certificate template.

Problem Cause

the Enable-VdaSSL.ps1 script specifies the Crypto API to access the private key, this will not work if the certificate template specifies only KSP to access the private key. 


      #Check private key availability

      try

      {

        [System.Security.Cryptography.AsymmetricAlgorithm] $PrivateKey = $Certificate.PrivateKey 

        $UniqueContainer = ((($Certificate).PrivateKey).CspKeyContainerInfo).UniqueKeyContainerName

      }

      catch

image.png