📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

How do you manage TLS and signing certificates for .NET services in Azure and Kubernetes? Cover automated renewal, App Service managed certificates versus Key Vault certificates, cert-manager on AKS, getting a renewed certificate to running apps without a restart, monitoring expiry, the move to much shorter certificate lifetimes, and what post-quantum cryptography means for your plans.

Covers certificate lifecycle at scale: inventory, automated issuance and renewal (App Service managed certificates, Key Vault issuers, cert-manager/ACME), distributing renewed certificates, expiry monitoring, the CA/Browser Forum schedule to 47-day TLS certificates, and post-quantum readiness with ML-KEM and ML-DSA in .NET 10.

Senior Theory Advanced azure-key-vault certificates cryptography kubernetes post-quantum security

🎯 Key points

  • Certificate expiry is a top cause of avoidable outages: inventory every cert (public TLS, mTLS, signing, IdP) with owner and expiry
  • CA/B Forum SC-081 phases down public TLS validity: 200 days for certificates issued since 15 March 2026 (the current limit as of late 2026), 100 days from 15 March 2027, 47 days from 15 March 2029
  • Shorter lifetimes mean renewal several times a year per cert, so issuance, deployment and reload must be fully automated and tested with short-lived certs in staging
  • App Service managed certificates: free, auto-renewed, not exportable, no wildcards; Key Vault certificates with an integrated CA for wildcards or shared use
  • AKS: cert-manager with ACME or a private issuer; Key Vault via Secrets Store CSI driver with rotation enabled
  • Apps must pick up renewed certs: ServerCertificateSelector or config reload for Kestrel, handler refresh for outgoing mTLS; App Service syncs Key Vault certs within about 24 hours
  • Monitor: Key Vault CertificateNearExpiry Event Grid events plus synthetic probes on the presented certificate, alerts at 30/14/7 days
  • Post-quantum: inventory RSA/ECC use, crypto agility, hybrid ML-KEM key exchange; .NET 10 MLKem/MLDsa need OpenSSL 3.5+ or Windows with PQC; ASD targets end of 2030

⏱ 30-second answer

Treat certificates as inventory with an owner, an expiry and an automated renewal path, because expiry outages are entirely avoidable. Public TLS certificates now last at most 200 days (since 15 March 2026) and drop to 100 days in 2027 and 47 days in 2029 under CA/Browser Forum ballot SC-081, so manual renewal is no longer viable.

On App Service, managed certificates are free and auto-renewed but not exportable or wildcard; otherwise use Key Vault certificates with an integrated CA and let App Service sync them. On AKS, cert-manager with ACME or a private issuer, or the Key Vault CSI driver with rotation. Make sure apps reload renewed certificates and monitor days-to-expiry with alerts. For post-quantum, inventory where RSA and ECC are used, build crypto agility, and track ML-KEM/ML-DSA support (available in .NET 10 on OpenSSL 3.5+ and recent Windows).

🗣 Full answer (senior)

How I would answer this in an interview

"I start with an inventory, because the certificate that takes you down is always the one nobody knew about: the mTLS client certificate for a partner, the SAML signing cert, the one baked into an on-prem gateway. Each gets an owner, an expiry date, and an automated renewal path, and I alert at 30, 14 and 7 days.

Automation is now mandatory, not nice to have. Since March 2026 public TLS certificates can't exceed 200 days, next year it's 100 and by 2029 it's 47 days, so anything renewed by a calendar reminder will eventually fail. On App Service I use managed certificates where they fit: free and auto-renewing, but they're not exportable and don't do wildcards. For wildcards or certificates shared across services I issue them in Key Vault with an integrated CA, let Key Vault auto-renew, and App Service picks up the new version on its sync. On AKS, cert-manager with an ACME issuer handles ingress certificates, and for app-level certificates I mount Key Vault through the Secrets Store CSI driver with rotation enabled.

The step people miss is getting the new certificate into the running process. For example, at [company] Key Vault renewed [an mTLS client certificate] on time, but our [payment service] had loaded it once at start-up, so [calls to the bank started failing at expiry]. The fix was to load it through a provider that watches for the new version and rebuilds the HttpClient handler, and to add a synthetic check comparing the expiry of the certificate the process actually presents. [We haven't had a certificate incident since.]

On post-quantum: the immediate risk is harvest-now-decrypt-later for long-lived confidential data. I don't rip out RSA today, but I inventory where we use RSA and ECC, prefer TLS stacks that support hybrid ML-KEM key exchange, avoid hard-coding algorithms, and track that .NET 10's MLKem and MLDsa work only where the OS crypto supports them, OpenSSL 3.5 or recent Windows. ASD wants traditional asymmetric crypto gone by 2030, so crypto agility is the real deliverable."


Options in Azure

Option Strengths Limits Use when
App Service managed certificate Free, auto-renew, zero effort Not exportable, no wildcard, App Service only Single-host public sites
Key Vault certificate with integrated CA (DigiCert, GlobalSign) Auto-renew, wildcard, shareable, audit CA cost, sync delay to consumers Shared or wildcard certs, OV/EV
Key Vault + private CA Internal mTLS, signing You run the CA or use a managed PKI Service-to-service identity
cert-manager (AKS) + ACME Free public certs, Kubernetes-native Needs DNS/HTTP challenge access Ingress TLS
Front Door / App Gateway managed certs Edge TLS handled for you Edge only Public endpoints behind the edge

CA/Browser Forum schedule (SC-081)

From Max public TLS validity
15 March 2026 200 days
15 March 2027 100 days
15 March 2029 47 days

Post-quantum in .NET 10

Algorithm Purpose .NET type Requirement
ML-KEM (FIPS 203) Key encapsulation MLKem OpenSSL 3.5+ or Windows CNG with PQC
ML-DSA (FIPS 204) Signatures MLDsa Same; check IsSupported
SLH-DSA (FIPS 205) Hash-based signatures SlhDsa Experimental in .NET 10

Production example

After centralising [about 60] certificates into Key Vault with Event Grid expiry alerts and a daily synthetic check, we went from [three expiry incidents in a year] to none, and the move to 200-day public certificates in March 2026 needed no process change.

🔍 What the interviewer is checking

Checks whether the candidate can run certificates as an automated, monitored lifecycle across Azure and Kubernetes, and has a realistic view of upcoming changes.

Green flags

  • Starts with an inventory and owners
  • Knows the shorter-lifetime schedule and why automation is required
  • Explains how renewed certificates reach running processes and monitors the live endpoint
  • Gives a sensible post-quantum stance: inventory, agility, hybrid key exchange, platform support in .NET 10

Red flags

  • Manual renewal processes
  • Only monitors the vault, not what is served
  • Dismisses post-quantum entirely or proposes ripping out RSA immediately

📚 Learn in depth

1. The lifecycle

request -> issue -> store (Key Vault / K8s secret) -> distribute -> load in process
   ^                                                                  |
   +------------- renew (auto, before expiry) <- monitor days left <--+
                         revoke on compromise

Every arrow is a failure point. Most outages are at distribute or load: the vault renewed, but the app still serves the old certificate.

2. Getting renewed certificates into running .NET apps

  • App Service: certificates imported from Key Vault are synced periodically (within about 24 hours); bindings update without a code change.
  • Kestrel: configure the certificate from configuration with reloadOnChange, or use ServerCertificateSelector to fetch the current certificate from a cache refreshed in the background.
  • Outgoing mTLS: SocketsHttpHandler.SslOptions.LocalCertificateSelectionCallback returning the current certificate, or rebuild handlers by setting PooledConnectionLifetime so new connections use the new certificate.
  • AKS: CSI driver enableSecretRotation updates the mounted file; the app must watch the file or be restarted by a reloader.

3. Monitoring

  • Key Vault emits CertificateNearExpiry and CertificateExpired via Event Grid.
  • Synthetic checks from outside: connect, read the presented certificate's NotAfter, alert under threshold. This catches the "renewed but not loaded" case.
  • Defender for Cloud and Azure Policy can flag certificates with long validity or weak keys.

4. Shorter lifetimes

Shorter validity reduces the damage of a compromised key and the reliance on revocation (CRLs and OCSP are unreliable at scale). Domain validation reuse periods shrink too, so ACME DNS-01 automation with scoped DNS credentials becomes standard.

5. Post-quantum readiness

  • Harvest now, decrypt later: traffic recorded today can be decrypted once large quantum computers exist; this affects key exchange first. Hybrid key exchange (X25519 + ML-KEM) in TLS addresses it.
  • Signatures matter for long-lived trust (firmware, document archives, root CAs).
  • Crypto agility: algorithm identifiers in data formats, no hard-coded algorithms, a central crypto service.
  • .NET 10: MLKem, MLDsa, SlhDsa in System.Security.Cryptography, delegating to OpenSSL 3.5+ or Windows CNG with PQC support; macOS not supported. Check IsSupported.

Try it yourself

  1. List every certificate your system uses, including client certs and IdP signing certs, with owner and expiry.
  2. Create a Key Vault certificate with a 1-month validity and an auto-renew lifetime action; subscribe to CertificateNearExpiry.
  3. Install cert-manager on a test AKS cluster with Let's Encrypt staging.
  4. Write a small console app that connects to your endpoints and prints days until expiry.
  5. On Linux with OpenSSL 3.5, call MLKem.IsSupported and generate a key with MLKem.GenerateKey(MLKemAlgorithm.MLKem768).

💻 Code

A Kestrel server certificate selector that serves the latest Key Vault certificate without a restart, and a small expiry probe.

using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Azure.Identity;
using Azure.Security.KeyVault.Certificates;

namespace Edge.Tls;

public sealed class RollingCertificate(CertificateClient client, string name, ILogger<RollingCertificate> log)
    : BackgroundService
{
    private volatile X509Certificate2? _current;
    public X509Certificate2? Current => _current;

    protected override async Task ExecuteAsync(CancellationToken ct)
    {
        using var timer = new PeriodicTimer(TimeSpan.FromHours(1));
        do
        {
            try
            {
                // Downloads the latest version including the private key (requires get on secrets).
                X509Certificate2 cert = await client.DownloadCertificateAsync(name, cancellationToken: ct);
                if (_current?.Thumbprint != cert.Thumbprint)
                {
                    _current = cert;
                    log.LogInformation("Loaded certificate {Thumbprint}, expires {NotAfter:u}", cert.Thumbprint, cert.NotAfter);
                }
            }
            catch (Exception ex) when (_current is not null)
            {
                log.LogWarning(ex, "Refresh failed; keeping current certificate");
            }
        } while (await timer.WaitForNextTickAsync(ct));
    }
}
// Program.cs
var vaultUri = new Uri(builder.Configuration["KeyVault:Uri"]!);
builder.Services.AddSingleton(new CertificateClient(vaultUri, new DefaultAzureCredential()));
builder.Services.AddSingleton(sp => new RollingCertificate(
    sp.GetRequiredService<CertificateClient>(), "api-tls", sp.GetRequiredService<ILogger<RollingCertificate>>()));
builder.Services.AddHostedService(sp => sp.GetRequiredService<RollingCertificate>());

builder.WebHost.ConfigureKestrel((ctx, k) => k.ConfigureHttpsDefaults(https =>
{
    var rolling = k.ApplicationServices.GetRequiredService<RollingCertificate>();
    https.ServerCertificateSelector = (_, _) => rolling.Current; // evaluated per TLS handshake
}));
// Expiry probe: what is actually presented on the wire, not what the vault says.
using System.Net.Security;
using System.Net.Sockets;

static async Task<int> DaysLeftAsync(string host, CancellationToken ct)
{
    using var tcp = new TcpClient();
    await tcp.ConnectAsync(host, 443, ct);
    using var ssl = new SslStream(tcp.GetStream());
    await ssl.AuthenticateAsClientAsync(new SslClientAuthenticationOptions { TargetHost = host }, ct);
    var cert = new X509Certificate2(ssl.RemoteCertificate!);
    return (int)(cert.NotAfter.ToUniversalTime() - DateTime.UtcNow).TotalDays;
}

⚠ Common mistakes

  • Mistake: Tracking certificate expiry in a spreadsheet or calendar. Why it is wrong: with 200-day (and soon 47-day) certificates, someone will miss one. Instead: automated renewal with Key Vault, App Service managed certs or cert-manager, plus alerts.
  • Mistake: Loading certificates once at start-up. Why it is wrong: the vault renews, the process keeps serving the old certificate until it expires. Instead: a selector or reload mechanism, or scheduled restarts tied to renewal.
  • Mistake: Monitoring only the vault's expiry date. Why it is wrong: it misses certificates that renewed but weren't deployed. Instead: synthetic checks against the live endpoint.
  • Mistake: Forgetting non-TLS certificates (SAML/OIDC signing, partner mTLS, code signing). Why it is wrong: they expire too and break sign-in or integrations. Instead: one inventory covering every certificate.
  • Mistake: Exporting private keys to many servers. Why it is wrong: wider exposure and harder rotation. Instead: non-exportable keys, edge termination, or per-service certificates.
  • Mistake: Treating post-quantum as a future problem with no action. Why it is wrong: harvest-now-decrypt-later already applies to long-lived secrets, and migrations take years. Instead: inventory, crypto agility, hybrid key exchange where available.
  • Mistake: Calling the PQC APIs without checking IsSupported. Why it is wrong: they throw PlatformNotSupportedException on older OpenSSL, macOS or unpatched Windows. Instead: feature-detect and fall back.

🏛 Senior insight: trade-offs

Push TLS termination to managed edges (Front Door, App Gateway, App Service) where the platform renews for you, and keep certificates inside the app only where you must (mTLS, signing). Each certificate you don't own is one fewer outage. For those you do own, the senior deliverable is a runbook and an inventory, not a script.

Approach When it fits Cost When not
Edge-managed TLS Public HTTP endpoints Little control over cert details mTLS to backend or EV requirements
Key Vault + integrated CA Wildcards, shared certs, audit needs CA fees, sync delays Simple single-site apps
cert-manager + ACME Kubernetes ingress DNS automation and rate limits Internal-only names without a private issuer
Private PKI Service identity, mTLS Running a CA Public browser trust

For post-quantum, the measurable goal is an inventory of algorithm use across services and a target date per system, aligned to ASD's 2030 guidance.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate talks about certificate chains or loading PFX files. Why: Checks chain validation and X509CertificateLoader usage.
    How to answer

    A digital signature is a hash of the data transformed with a private key; anyone with the matching public key can verify the data is unchanged and came from the key holder. An X.509 certificate answers "whose public key is this?": it binds a public key to a subject (and SAN names), with validity dates and key usages, and is itself signed by a CA. Verifying means building a chain from the leaf through intermediates to a trusted root, checking dates, EKU, name and revocation.

    In .NET you sign with cert.GetECDsaPrivateKey() or GetRSAPrivateKey() and validate with X509Chain. Since .NET 9, load certificates with X509CertificateLoader (LoadCertificate, LoadPkcs12): the old X509Certificate2 constructors are obsolete (SYSLIB0057) because they guessed the format from content. The trade-off: PKI gives verifiable identity at the cost of lifecycle management.

  2. When: Candidate mentions TLS handshake or certificate validation errors. Why: Checks TLS 1.3 handshake and safe fixes for remote certificate errors.
    How to answer

    HTTPS is HTTP inside TLS. TLS gives confidentiality (encryption), integrity (tamper detection) and server authentication (certificates).

    TLS 1.3 handshake (one round trip): the client sends supported ciphers, a key share, SNI (hostname) and ALPN (h2); the server replies with its key share, certificate chain and a signature proving it owns the private key. Both derive session keys via ECDHE (forward secrecy).

    The client validates: chain to a trusted root, not expired, hostname matches the SAN, and optionally revocation.

    For "remote certificate is invalid": read the SslPolicyErrors / chain status, inspect with openssl s_client -showcerts, then fix the real cause (expired cert, missing intermediate, wrong hostname, or a private/corporate root CA not trusted in the container). Never return true from ServerCertificateCustomValidationCallback in production.

  3. When: Candidate stores certificates in Key Vault. Why: Checks key management, versioning and rotation in Key Vault.
    How to answer

    Treat keys as long-lived identities with a lifecycle. In Azure Key Vault, a key is non-exportable: you send data to it for wrap/unwrap/sign, while a secret is a value your app downloads (connection strings, API keys). For data encryption use envelope encryption: generate a random data encryption key (DEK) locally, encrypt with AES-GCM, and have a Key Vault key-encryption key (KEK) wrap the DEK; store only the wrapped DEK beside the data.

    Rotation without downtime depends on key ids: every ciphertext records which key version wrapped it, new writes use the newest version, old versions stay enabled for decrypt, and a background job optionally rewraps DEKs before old versions are disabled. Use Premium (HSM-backed) or Managed HSM when regulation or key value demands it. The trade-off is security and auditability versus latency, throttling and operational complexity.

🛠 Real-world problems: how you handle them

Partner mTLS certificate renewed in Key Vault but not picked up by the service
Situation
A [payments service] on [AKS] used an mTLS client certificate to call [a bank's API]. Key Vault auto-renewed the certificate [two weeks before expiry].
Signals
At the old certificate's expiry, calls to the bank failed with TLS handshake errors (`AuthenticationException`); payment success rate dropped to [0%] for that route; Key Vault showed a valid new version.
Investigation
Compared the thumbprint the service presented (logged in the handler and confirmed by the bank) with the latest Key Vault version; found the certificate was loaded once at start-up into a singleton `HttpClient` handler; checked the CSI driver mount had the new file but nothing reloaded it.
Resolution
Immediately restarted the deployment to load the new certificate. Then implemented a rolling certificate provider with `LocalCertificateSelectionCallback` and `PooledConnectionLifetime` so new connections use the current certificate.
Prevention
Synthetic check that records the presented certificate's expiry; alert at 30/14/7 days on *presented* certificates; certificate inventory with owners; renewal drills in staging using short-lived certificates.

How to tell it (STAR)

**S:** At [company] our [payments service] suddenly couldn't reach [the bank] even though Key Vault had renewed the mTLS certificate weeks earlier. **T:** I led the incident and then had to make sure it couldn't happen again. **A:** I compared the thumbprint we were presenting with the vault's latest version and found we loaded the certificate once at start-up. I restarted to restore service, then built a provider that refreshes the certificate and lets new connections use it, and added a synthetic check on the certificate actually presented. I also built a certificate inventory with owners. **R:** Payments were restored in [about 25 minutes]; since then [every renewal, including the move to 200-day certificates,] has rolled over automatically with [zero] incidents.

More in Cryptography

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me