{
  "id": "CB-M365-APPS-009",
  "standard": "m365",
  "version": "main",
  "url": "https://baselines.cirsec.org/b/m365/CB-M365-APPS-009",
  "json": "https://baselines.cirsec.org/b/m365/CB-M365-APPS-009.json",
  "yaml": "https://baselines.cirsec.org/b/m365/CB-M365-APPS-009.yml",
  "profiles_effective": [
    "baseline",
    "hardened"
  ],
  "license": "Text CC BY 4.0, code Apache-2.0",
  "attribution": "CIRSEC Baselines, https://baselines.cirsec.org",
  "control": {
    "id": "CB-M365-APPS-009",
    "title": "Limit the lifetime of application certificates",
    "finding": {
      "title": "Application certificates can be registered with a lifetime of several years",
      "description": "A certificate credential that stays valid for years gives an attacker who copied the private key long-lasting access as the application."
    },
    "status": "active",
    "profiles": [
      "baseline"
    ],
    "risk": {
      "severity": "medium"
    },
    "assessment": "manual",
    "tags": [
      "applications",
      "workload-identities",
      "credentials",
      "certificates",
      "app-management-policy"
    ],
    "description": "The tenant-wide app management policy enforces a maximum lifetime of\n**{{ app_cert_max_days }}** days for asymmetric key credentials (certificates) added to\napplications and service principals.\n",
    "rationale": "Certificates are the preferred application credential, but a private key exported from a\nserver or a pipeline is as useful to an attacker as a secret. A short lifetime limits the window\nof use of a stolen key and makes rotation a routine operation rather than an emergency.\n",
    "impact": "Certificates must be renewed at least every {{ app_cert_max_days }} days. Automate renewal (for\nexample through Azure Key Vault) before enforcing. Certificates issued by public CAs with a\nlonger validity cannot be uploaded until reissued.\n",
    "setting": {
      "location": "Entra admin center > Entra ID > Enterprise apps > Application policies > Restrict max certificate lifetime (Graph policies/defaultAppManagementPolicy, keyCredentials restriction asymmetricKeyLifetime)",
      "default_value": "Not configured",
      "recommended_value": "On, at most {{ app_cert_max_days }} days, applies to all applications"
    },
    "parameters": [
      {
        "name": "app_cert_max_days",
        "type": "integer",
        "description": "Maximum lifetime of a new application certificate.",
        "unit": "days",
        "default": 180,
        "minimum": 1,
        "maximum": 365
      }
    ],
    "audit": {
      "manual": "1. Sign in to the Microsoft Entra admin center (https://entra.microsoft.com) as at least a\n   Global Reader.\n2. Browse to **Entra ID** > **Enterprise apps** > **Application policies**.\n3. Check that the certificate lifetime restriction is **On**, set to at most\n   {{ app_cert_max_days }} days, and applies to **All applications**.\n4. Alternative with Graph (scope `Policy.Read.All`):\n   `GET https://graph.microsoft.com/v1.0/policies/defaultAppManagementPolicy`. Check that\n   `isEnabled` is `true` and that `keyCredentials` for applications and service principals\n   contains `asymmetricKeyLifetime` with `state` = `enabled` and `maxLifetime` of at most\n   `P{{ app_cert_max_days }}D`.\n5. Fail if the restriction is missing, disabled or longer than {{ app_cert_max_days }} days.\n"
    },
    "remediation": {
      "manual": "1. Sign in to the Microsoft Entra admin center as a Security Administrator together with\n   Application Administrator or Cloud Application Administrator.\n2. Browse to **Entra ID** > **Enterprise apps** > **Application policies** and open the\n   certificate lifetime restriction.\n3. Set it to **On**, enter {{ app_cert_max_days }} days, set **Applies to** to **All\n   applications** and select **Save**.\n4. Graph alternative (scope `Policy.ReadWrite.ApplicationConfiguration`):\n   `PATCH https://graph.microsoft.com/v1.0/policies/defaultAppManagementPolicy` adding\n   `{\"restrictionType\": \"asymmetricKeyLifetime\", \"state\": \"enabled\", \"maxLifetime\": \"P{{ app_cert_max_days }}D\"}`\n   to `keyCredentials` for applications and service principals, keeping existing restrictions.\n",
      "rollback": "Set the certificate lifetime restriction to **Off** or raise the maximum lifetime.\n"
    },
    "references": [
      {
        "title": "Configure restrictions on how applications can be configured",
        "url": "https://learn.microsoft.com/entra/identity/enterprise-apps/configure-app-management-policies",
        "publisher": "Microsoft",
        "kind": "vendor-doc",
        "accessed": "2026-10-24"
      },
      {
        "title": "tenantAppManagementPolicy resource type",
        "url": "https://learn.microsoft.com/graph/api/resources/tenantappmanagementpolicy",
        "publisher": "Microsoft",
        "kind": "vendor-doc",
        "accessed": "2026-10-24"
      }
    ],
    "mappings": [
      {
        "framework": "cisa-scuba-m365",
        "framework_version": "2.0.0",
        "id": "MS.AAD.5.7v1",
        "relation": "stricter",
        "note": "180 days by default instead of 365."
      },
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "IA-5(2)",
        "relation": "related"
      },
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "IA-9",
        "relation": "related"
      }
    ],
    "related_controls": [
      {
        "id": "CB-M365-APPS-007",
        "type": "related"
      },
      {
        "id": "CB-M365-APPS-010",
        "type": "related"
      }
    ],
    "authors": [
      {
        "name": "Alice",
        "github": "Sn0wAlice"
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-24",
    "updated": "2026-10-24"
  }
}