Skip to content

Setting it up

Certificates

Creating the credential, and rotating it before it expires.

The application authenticates with a certificate rather than a client secret. A secret in an environment variable is a secret in a shell history, a backup and a screenshot; a certificate’s private key stays on the host.

scripts/new-graph-certificate.sh produces a key, a self-signed certificate and a PKCS#12 bundle. Upload the public certificate to the app registration; keep the bundle and its password in the deployment’s secrets directory, readable only by the service account.

Self-signed is correct here. The certificate is not proving an identity to the public internet — it is proving to Entra that the holder is the registration it says it is, and Entra checks the thumbprint it was given rather than a chain.

Rotation is additive, which is what makes it safe:

  1. Create the new certificate and upload it beside the old one. A registration may hold several.
  2. Point the deployment at the new bundle and restart.
  3. Confirm with scripts/verify-graph-certificate.sh.
  4. Remove the old certificate from the registration.

At no point is there a moment with no valid credential. The dashboard warns as expiry approaches, with thresholds on the monitoring settings, because the failure mode of a forgotten certificate is a deployment that stops entirely at a date nobody wrote down.