title: Invalid provider type specified. CryptographicException
body: <p>I am trying to run the script GetAppConfigSettings.ps1 from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=45343" rel="noreferrer">Microsoft docs help setting up a Key Vault</a></p>
  
  <p>The script contains the following</p>
  
  <pre><code># **********************************************************************************************
  # Prep the cert credential data
  # **********************************************************************************************
  $certificateName = "$applicationName" + "cert"
  $myCertThumbprint = (New-SelfSignedCertificate -Type Custom -Subject "$certificateName"-KeyUsage DigitalSignature -KeyAlgorithm RSA -KeyLength 2048 -CertStoreLocation "Cert:\CurrentUser\My" -Provider "Microsoft Enhanced Cryptographic Provider v1.0" ).Thumbprint
  $x509 = (Get-ChildItem -Path cert:\CurrentUser\My\$myCertthumbprint)
  $password = Read-Host -Prompt "Please enter the certificate password." -AsSecureString
  
  # Saving the self-signed cert and pfx (private key) in case it's needed later
  Export-Certificate -cert $x509 -FilePath ".\$certificateName.cer"
  Export-PfxCertificate -Cert $x509 -FilePath ".\$certificateName.pfx" -Password $password
  </code></pre>
  
  <p>Running the script ( after setting the variables)  produces the following error</p>
  
  <pre><code>New-SelfSignedCertificate : CertEnroll::CX509Enrollment::_CreateRequest: Provider type not defined. 
  0x80090017 (-2146893801 NTE_PROV_TYPE_NOT_DEF)
  At \\tsclient\E\EShared\Dev\Microsoft.Azure.KeyVault.Samples-2016.11.22 
  (1)\Microsoft.Azure.KeyVault.Samples\scripts\GetAppConfigSettings.ps1:38 char:22
  + ... umbprint = (New-SelfSignedCertificate -Type Custom -Subject "$certifi ...
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [New-SelfSignedCertificate], Exception
      + FullyQualifiedErrorId : System.Exception,Microsoft.CertificateServices.Commands.NewSelfSignedC 
     ertificateCommand
  </code></pre>
  
  <p>[Update]</p>
  
  <p>Microsoft Support advised me to change the provider to "Microsoft Platform Crypto Provider"</p>
  
  <p>However I still get the error.</p>
  
  <p>For Powershell, $PSVersionTable reports 5.1.17134.112</p>
  
  <p>I have Version 5.7.0 of AzureRM installed</p>