Information
In Microsoft Entra ID, applications and service principals can authenticate using certificate credentials. This setting enforces a tenant-wide maximum lifetime for new certificate credentials added to any application registration or service principal. When enabled, any certificate uploaded must have a validity period that falls within the configured maximum, which for this recommendation is 180 days or less. The policy is implemented through the default app management policy and applies to all applications unless scoped exceptions are configured.
The setting does not retroactively shorten or invalidate existing certificate credentials; certificates uploaded before the policy was enabled remain valid until they expire or are explicitly removed.
The recommended state is Restrict maximum certificate lifetime set to On : 180 days or less.
Long-lived certificates extend the window of exploitation if a credential is compromised. A certificate valid for multiple years that is never rotated remains usable even if the private key was exposed through a server breach, misconfigured storage, or supply-chain compromise long after the initial exposure. Enforcing a maximum lifetime of 180 days ensures that certificates expire on a regular basis, limiting the period during which a stolen credential remains valid and reducing the blast radius of a compromise. This control also encourages teams to establish automated certificate rotation practices, which further reduces reliance on static, long-lived credentials.
Solution
To remediate using the UI:
- Navigate to Microsoft Entra admin center https://entra.microsoft.com/.
- Expand Entra ID and select Enterprise apps.
- Under Security select Application policies.
- Select Restrict max certificate lifetime.
- Set Status to On.
- Set Applies to to one of the following:
- All applications
- All applications with exclusions (if using exclusions, ensure they are reviewed annually).
- Set Only apply to apps created after to a desired date or leave it unconfigured.
- Set Maximum lifetime (in days) to 180 days or less.
- Select Save and close to apply the changes.
To remediate using the Microsoft Graph API:
- Execute a GET request to retrieve the current policy:
v1.0/policies/defaultAppManagementPolicy
- Modify the returned JSON to reflect the following changes:
- Set isEnabled to true.
- Under applicationRestrictions.keyCredentials, locate the entry where restrictionType is asymmetricKeyLifetime and set the following:
- state to enabled
- maxLifetime to P180D or a shorter duration.
- restrictForAppsCreatedAfterDateTime to 0001-01-01T00:00:00Z or a desired date.
- Under servicePrincipalRestrictions.keyCredentials, locate the entry where restrictionType is asymmetricKeyLifetime and set the following:
- state to enabled
- maxLifetime to P180D or a shorter duration.
- restrictForAppsCreatedAfterDateTime to 0001-01-01T00:00:00Z or a desired date.
- Execute a PATCH request to the same URI with the modified JSON in the request body to apply the changes.
Note: The References section includes a link to the API documentation with full remediation examples in multiple languages including HTTP, PowerShell, and Python.
Impact:
Any automated process, pipeline, or script that uploads certificates with a validity period exceeding the configured maximum will be blocked once the policy is enabled, unless an exception is configured. Organizations will need to update certificate issuance workflows to generate certificates with expiration dates within the allowed range and establish rotation processes for certificates approaching expiry.