Just wondering how you would achieve the same using the new Azure.Security.KeyVault libraries:
Azure.Security.KeyVault.Certificates
Azure.Security.KeyVault.Secrets
Particularly with regards to getting the PFX content from the certificate SecretId. The new libraries don't seem to offer a way to get the Secret by SecretId or SecretIdentifier, only by name.
With the aim of matching what would have previously been done like this:
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var keyVaultClient = new KeyVaultClient(
new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
CertificateBundle certificateBundle = await keyVaultClient.GetCertificateAsync(certificateIdentifier);
SecretBundle certificateWithPrivateKey = await keyVaultClient.GetSecretAsync(certificateBundle.SecretIdentifier.Identifier);
byte[] certificateWithPrivateKeyDecoded = Convert.FromBase64String(certificateWithPrivateKey.Value);
var certificate = new X509Certificate2(certificateWithPrivateKeyDecoded, (string)null);
return certificate;
