Skip to main content
AppAlert

Certificate vs. client secret for Entra app authentication

Choose a certificate or federated credential over a client secret for confidential clients, then find expiry checks and renewal guides.

Reviewed

On this page

Short answer

For a confidential client moving to production, prefer a certificate or federated credential over a client secret. Microsoft calls client secrets less secure and advises against using them in production. They can be convenient for local development. See Microsoft's credential guidance.

Start by checking whether your workload can avoid a credential you must rotate yourself. Microsoft's app registration security guidance prefers a suitable managed identity, then federation from a trusted platform, then certificates.

What each credential is

A client secret is an application password: a string the app uses to identify itself. A certificate credential lets an app authenticate with a signed assertion instead. Certificates can be used where a client secret could be used. See Microsoft's credential overview and certificate credentials.

Federated identity credentials let workloads on GitHub Actions, Kubernetes, and other supported OIDC platforms authenticate without managing a secret. See Microsoft's federated credential guidance.

How authentication differs

With a shared secret, the app sends the secret string as client_secret in its token request. With a certificate, it sends a JWT assertion signed using the app's private key as client_assertion, plus client_assertion_type. The certificate flow replaces the shared secret with proof that the app holds the private key. See the client credentials flow.

Microsoft describes certificate authentication as private_key_jwt. Its assertion format uses the x5t#S256 header for the certificate's SHA-256 thumbprint. See the certificate assertion format.

Lifetime, storage, and rotation burden

In the Microsoft Entra admin center, a client secret can last at most 24 months, and Microsoft recommends less than 12 months. That limit belongs to the portal. Microsoft Graph addPassword and Microsoft Graph PowerShell accept a later end date unless your organization restricts secret lifetimes with an application management policy (passwordLifetime). The secret Value is displayed only once after creation. See Microsoft's client secret guidance.

A certificate still needs private key protection and a renewal plan. Microsoft recommends secure certificate management and documents public certificate uploads in .cer, .pem, or .crt format, with the thumbprint recorded for the app. See Microsoft's certificate guidance.

For either credential, assign an owner, record where the workload gets its credential, and plan time to replace and verify it before expiry. Treat rotation as a workload change: creating a replacement is only part of the work.

When to pick which

Use this order from Microsoft's security best practices. Check the workload's hosting and identity requirements before choosing.

  • Azure workload fits managed identity requirements: prefer managed identity. Confirm the hosting service and access requirements fit.
  • Workload runs on a trusted platform that supports federation: prefer a federated credential. Configure and maintain the trust relationship.
  • Neither managed identity nor federation fits: prefer a certificate. Protect the private key and own renewal.
  • Local development needs a convenient temporary credential: a client secret can be acceptable. Keep it out of source control and replace it before production.

Managed identity is a fit to consider when the service runs in Azure, does not sign in users, is not itself a web API resource, and does not need to operate across multiple organizations. See Microsoft's managed identity criteria. Do not use password secrets in production; see Microsoft's production credential guidance.

After you choose: find expiry, renew, and read AADSTS errors

For expiry checks, start with monitoring Entra app secret and certificate expiration. For replacement work, use the expired client secret guide or the expired client authentication certificate guide.

If authentication is already failing, use the AADSTS error hub to find the matching error and its troubleshooting guide.

Before changing a credential, find which workload uses it. Then use app secret expiration alerts to plan who gets warned and who handles renewal.

Next: SAML signing certificates →