Created
June 8, 2025 16:49
-
-
Save buchizo/37f88fd127fc8eec5aad038f0bf35643 to your computer and use it in GitHub Desktop.
get pfx from Azure KeyVault
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var secretClient = new SecretClient(new Uri("https://___.vault.azure.net"), new DefaultAzureCredential()); | |
var certClient = new CertificateClient(new Uri("https://___.vault.azure.net"), new DefaultAzureCredential()); | |
var cert = await certClient.GetCertificateAsync("localhostcert"); | |
var secret = await secretClient.GetSecretAsync(cert.Value.Name); | |
var pfxb = Convert.FromBase64String(secret.Value.Value); | |
var x509cert = X509CertificateLoader.LoadPkcs12(pfxb, "", X509KeyStorageFlags.MachineKeySet); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment