title: Import pfx certificate to azure key vault
body: <p>I'm trying to import a pfx certificate to the azure key vault, but I'm getting an error saying that no certifcate with private key was found.</p>
  <p>I'm using the ImportCertifcateOptions, not sure if &quot;certificate.RawData&quot; is the way to go.</p>
  <p>This is the code that I'm using</p>
  <pre><code>var certificate = new X509Certificate2(
              localFilePath, 
              password, 
              X509KeyStorageFlags.Exportable);
  
          if (!certificate.HasPrivateKey)
          {
              throw new BusinessException(&quot;No private key included&quot;);
          }
  
          var importOptions = new ImportCertificateOptions(name, certificate.RawData);
          var azureKeyVaultCertificate = await CertificateClient.ImportCertificateAsync(importOptions);
  </code></pre>
  <p>This is the error that I'm getting from azure.</p>
  <p><em>No certificate with private key found in the specified X.509 certificate content. Please specify X.509 certificate content with only one certificate containing private key.
  Status: 400 (Bad Request)</em></p>