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.
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).
"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
HttpClienthandler, 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
MLKemandMLDsawork 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."
| 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 |
| From | Max public TLS validity |
|---|---|
| 15 March 2026 | 200 days |
| 15 March 2027 | 100 days |
| 15 March 2029 | 47 days |
| 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 |
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.
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
Red flags
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.
reloadOnChange, or use ServerCertificateSelector to fetch the current certificate from a cache refreshed in the background.SocketsHttpHandler.SslOptions.LocalCertificateSelectionCallback returning the current certificate, or rebuild handlers by setting PooledConnectionLifetime so new connections use the new certificate.enableSecretRotation updates the mounted file; the app must watch the file or be restarted by a reloader.CertificateNearExpiry and CertificateExpired via Event Grid.NotAfter, alert under threshold. This catches the "renewed but not loaded" case.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.
MLKem, MLDsa, SlhDsa in System.Security.Cryptography, delegating to OpenSSL 3.5+ or Windows CNG with PQC support; macOS not supported. Check IsSupported.CertificateNearExpiry.MLKem.IsSupported and generate a key with MLKem.GenerateKey(MLKemAlgorithm.MLKem768).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;
}
IsSupported. Why it is wrong: they throw PlatformNotSupportedException on older OpenSSL, macOS or unpatched Windows. Instead: feature-detect and fall back.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.
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.
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.
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.
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.
Last updated 23 Nov 2026.