Closed Ofer-Gal closed 1 year ago
This has to do with the way KV stores certs.
Did you happen to see this post on this problem? https://stackoverflow.com/questions/51451902/azure-key-vault-certificates-does-not-have-the-private-key-when-retrieved-via-ik
Going to close this as this appears to be a quirk with the way KV works in conjunction with current KV Clients.
I am testing an Azure Function with a certificate that is coming from Azure Key Vault.
string vaultUrl = "https://{my}.vault.azure.net/"; var clientvault = new CertificateClient(vaultUri: new Uri(vaultUrl), credential: new DefaultAzureCredential()); KeyVaultCertificateWithPolicy certificateWithPolicy = clientvault.GetCertificate("CRM"); var certificate = new X509Certificate2(certificateWithPolicy.Cer, string.Empty, X509KeyStorageFlags.MachineKeySet);
then I create a clientusing(var client = new ServiceClient(certificate,StoreName.My,null, instanceUri, true, null, clientId, null, null))
and I get the following error:the certificate is self-signed created by the Azure Key Vault. I do not see anywhere a private key. What should I change to get it to work?
Thanks