0

I mount Azure Key Vault(AKV) certifcates to pods in Azure Kubernetes Service (AKS).

Use the Azure Key Vault Provider for Secrets Store CSI Driver in an AKS cluster

My pod's container image is based on ASP.NET Core Web API project template with below appsettings.json. I am trying to apply TLS on my service with Kestrel.

appsettings.json

appsettings.json

Configure endpoints for the ASP.NET Core Kestrel web server

However I am getting below error message, even Azure Key Vault provides the certifcate with private key.

What am I missing here?

Error message

ErrorMessage

secret-provider-class.yml

SecretProviderClass

deployment.yml

Deployment

Busybox

I checked PRIVATE KEY exists with busybox pod.

Busybox

ibocon
  • 1,352
  • 3
  • 17
  • 40

1 Answers1

0
  1. Please check if the issue here is the same case for you.

  2. You may have to configure your your data protection policy to use CryptographicAlogrithms as follow:

    .UseCryptographicAlgorithms(new AuthenticatedEncryptorConfiguration()
                    {
                        EncryptionAlgorithm = EncryptionAlgorithm.AES_256_CBC,
                        ValidationAlgorithm = ValidationAlgorithm.HMACSHA256
                    });
    

    Try configure the system with ProtectKeysWithAzureKeyVault in the Startup class.

    services.AddDataProtection()
            .ProtectKeysWithAzureKeyVault(kvClient, settings.KeyVaultKeyId);
    

    Please note that When a Key Vault certificate is created, it can be retrieved from the addressable secret with the private key in either PFX or PEM format. The policy used to create the certificate must indicate that the key is exportable. If the policy indicates non-exportable, then the private key isn't a part of the value when retrieved as a secret.

References:

  1. Configure ASP.NET Core Data Protection | Microsoft Docs
  2. linux - No XML encryptor configured -Stack Overflow / Using Azure Key Vault and Azure Storage to store Data Protection keys with ASP.NET Core - Joonas W's blog
kavyaS
  • 8,026
  • 1
  • 7
  • 19