{
  "title": "How to Automate Identifier Deactivation in Azure AD and Microsoft 365 for IA.L2-3.5.6 Compliance — NIST SP 800-171 REV.2 / CMMC 2.0 Level 2 - Control - IA.L2-3.5.6",
  "date": "2026-04-19",
  "author": "Lakeridge Technologies",
  "featured_image": "/assets/images/blog/2026/4/how-to-automate-identifier-deactivation-in-azure-ad-and-microsoft-365-for-ial2-356-compliance-nist-sp-800-171-rev2-cmmc-20-level-2-control-ial2-356.jpg",
  "content": {
    "full_html": "<p>IA.L2-3.5.6 (NIST SP 800-171 Rev.2 / CMMC 2.0 Level 2) requires that organizations disable identifiers after a defined period of inactivity; this post shows actionable, repeatable ways to automate identifier deactivation in Azure AD and Microsoft 365 so small and midsize organizations can meet the control with minimal operational friction.</p>\n\n<h2>Why this control matters and the risk of not automating</h2>\n<p>Unused or dormant accounts are a high‑value attack vector: they may retain permissions, have stale multi‑factor configurations, or be targeted by attackers for lateral movement. Failing to systematically deactivate inactive identifiers increases the risk of credential compromise, data exfiltration, and non‑compliance findings during assessments. Automation reduces human error, ensures repeatability for auditors, and shortens the window in which forgotten accounts can be exploited.</p>\n\n<h2>Define policy first: thresholds, exceptions, and lifecycle</h2>\n<p>Before implementing automation, define the business policy the automation will enforce. Key decisions: inactivity threshold (common choices are 30, 60, or 90 days depending on business risk), a staged action plan (e.g., notify → block sign-in → disable → delete), exception processes (contractors, long‑term remote employees, service accounts), and data retention requirements (mailbox retention, OneDrive content). Document these in your Compliance Framework artifacts (policy, SOP, and exception register) so automation has auditable parameters.</p>\n\n<h2>Technical approaches — options and recommended pattern</h2>\n<p>Three practical technical patterns work well in Azure AD / Microsoft 365: scheduled Graph/API-driven deactivation (recommended for most orgs), Access Reviews for resource-group/role membership cleanup, and HR-driven provisioning synchronizations for terminations. For IA.L2-3.5.6 specifically you typically combine sign-in activity data with a scheduled automation pipeline (Azure Function, Logic App, or Azure Automation runbook) that disables accounts and handles downstream cleanup (licenses, group membership).</p>\n\n<h3>Option A — Microsoft Graph + Azure Automation / Azure Function (recommended)</h3>\n<p>Overview: run a scheduled job that queries user sign-in activity, applies your inactivity rule, and executes a staged disable. Implementation details: use the Microsoft Graph API to read sign-inActivity (ensure sign-in logging is enabled and your tenant/license supports the property), run the job weekly, and use a service principal or managed identity with application permissions (User.Read.All, User.ReadWrite.All, AuditLog.Read.All if needed). The typical sequence is: 1) identify accounts with lastSignIn older than threshold; 2) send manager and user notifications; 3) set accountEnabled = false via Graph PATCH; 4) optionally remove or reassign licenses to avoid charges and convert mailboxes to inactive state per retention policy; 5) write a record to your compliance log (SIEM, Log Analytics) and create an exception ticket if required.</p>\n\n<pre><code>// REST example (conceptual)\nGET https://graph.microsoft.com/v1.0/users?$select=id,userPrincipalName,accountEnabled,signInActivity\nPATCH https://graph.microsoft.com/v1.0/users/{id}\nBody: { \"accountEnabled\": false }\n</code></pre>\n\n<h3>Option B — Azure AD Access Reviews + Entitlement Management</h3>\n<p>Access Reviews are useful when inactivity is tied to group or application membership rather than the user object itself. Configure periodic reviews for privileged groups and critical application access to remove stale entitlements; integrate with reviewers (managers) and schedule automatic removal of access. This does not directly set accountEnabled=false, so combine Access Reviews with the Graph-driven pipeline for full account deactivation.</p>\n\n<h2>Small‑business scenario: practical implementation</h2>\n<p>Example: a 50‑employee consultancy sets a 60‑day inactivity threshold. They implement a weekly Azure Function (Timer Trigger) that authenticates with a managed identity, queries Microsoft Graph for signInActivity, and enforces a three‑step workflow: 1) day 0 — automatic email to user & manager warning of inactivity; 2) day 7 — block interactive sign-in (set user account to \"Sign‑in blocked\" via accountEnabled=false); 3) day 30 after block — remove licenses and mark for deletion with a ticket in ServiceNow. The small business keeps a CSV export and Log Analytics workspace for auditors and uses a Logic App webhook to notify HR for any exceptions. This approach limits business disruption while keeping a defensible audit trail.</p>\n\n<h2>Operational and technical best practices</h2>\n<p>Do these to reduce risk and support audits: maintain versioned runbooks and store code in source control; use managed identities/service principals with certificate-based auth for automation; implement a staged disable (notify → block → disable → delete) and keep auditable logs of each step; handle service accounts carefully — exclude known service principals or require owner‑approved exceptions; and include license‑removal logic only after verifying retention needs (mailboxes and OneDrive retention should be dealt with via retention policies, not blind deletion).</p>\n\n<h2>Compliance tips and validation</h2>\n<p>For Compliance Framework evidence: retain runbook logs, change control approvals for policy settings and threshold changes, exception records, and periodic reports showing counts of disabled accounts and timelines. Test the automation in a staging tenant or with a scoped set of non‑production users. Provide your assessor with the automation design, code snippets, sample logs, and the schedule demonstrating repeatability against the policy.</p>\n\n<p>In summary, meeting IA.L2-3.5.6 in Azure AD/Microsoft 365 is best achieved by a documented policy plus a scheduled, auditable automation pipeline that uses Microsoft Graph (or Azure AD tooling) to identify inactive identifiers and apply a staged deactivation workflow; combine automation with Access Reviews, HR integration, and retention policies to minimize business impact while maintaining a strong compliance posture.</p>",
    "plain_text": "IA.L2-3.5.6 (NIST SP 800-171 Rev.2 / CMMC 2.0 Level 2) requires that organizations disable identifiers after a defined period of inactivity; this post shows actionable, repeatable ways to automate identifier deactivation in Azure AD and Microsoft 365 so small and midsize organizations can meet the control with minimal operational friction.\n\nWhy this control matters and the risk of not automating\nUnused or dormant accounts are a high‑value attack vector: they may retain permissions, have stale multi‑factor configurations, or be targeted by attackers for lateral movement. Failing to systematically deactivate inactive identifiers increases the risk of credential compromise, data exfiltration, and non‑compliance findings during assessments. Automation reduces human error, ensures repeatability for auditors, and shortens the window in which forgotten accounts can be exploited.\n\nDefine policy first: thresholds, exceptions, and lifecycle\nBefore implementing automation, define the business policy the automation will enforce. Key decisions: inactivity threshold (common choices are 30, 60, or 90 days depending on business risk), a staged action plan (e.g., notify → block sign-in → disable → delete), exception processes (contractors, long‑term remote employees, service accounts), and data retention requirements (mailbox retention, OneDrive content). Document these in your Compliance Framework artifacts (policy, SOP, and exception register) so automation has auditable parameters.\n\nTechnical approaches — options and recommended pattern\nThree practical technical patterns work well in Azure AD / Microsoft 365: scheduled Graph/API-driven deactivation (recommended for most orgs), Access Reviews for resource-group/role membership cleanup, and HR-driven provisioning synchronizations for terminations. For IA.L2-3.5.6 specifically you typically combine sign-in activity data with a scheduled automation pipeline (Azure Function, Logic App, or Azure Automation runbook) that disables accounts and handles downstream cleanup (licenses, group membership).\n\nOption A — Microsoft Graph + Azure Automation / Azure Function (recommended)\nOverview: run a scheduled job that queries user sign-in activity, applies your inactivity rule, and executes a staged disable. Implementation details: use the Microsoft Graph API to read sign-inActivity (ensure sign-in logging is enabled and your tenant/license supports the property), run the job weekly, and use a service principal or managed identity with application permissions (User.Read.All, User.ReadWrite.All, AuditLog.Read.All if needed). The typical sequence is: 1) identify accounts with lastSignIn older than threshold; 2) send manager and user notifications; 3) set accountEnabled = false via Graph PATCH; 4) optionally remove or reassign licenses to avoid charges and convert mailboxes to inactive state per retention policy; 5) write a record to your compliance log (SIEM, Log Analytics) and create an exception ticket if required.\n\n// REST example (conceptual)\nGET https://graph.microsoft.com/v1.0/users?$select=id,userPrincipalName,accountEnabled,signInActivity\nPATCH https://graph.microsoft.com/v1.0/users/{id}\nBody: { \"accountEnabled\": false }\n\n\nOption B — Azure AD Access Reviews + Entitlement Management\nAccess Reviews are useful when inactivity is tied to group or application membership rather than the user object itself. Configure periodic reviews for privileged groups and critical application access to remove stale entitlements; integrate with reviewers (managers) and schedule automatic removal of access. This does not directly set accountEnabled=false, so combine Access Reviews with the Graph-driven pipeline for full account deactivation.\n\nSmall‑business scenario: practical implementation\nExample: a 50‑employee consultancy sets a 60‑day inactivity threshold. They implement a weekly Azure Function (Timer Trigger) that authenticates with a managed identity, queries Microsoft Graph for signInActivity, and enforces a three‑step workflow: 1) day 0 — automatic email to user & manager warning of inactivity; 2) day 7 — block interactive sign-in (set user account to \"Sign‑in blocked\" via accountEnabled=false); 3) day 30 after block — remove licenses and mark for deletion with a ticket in ServiceNow. The small business keeps a CSV export and Log Analytics workspace for auditors and uses a Logic App webhook to notify HR for any exceptions. This approach limits business disruption while keeping a defensible audit trail.\n\nOperational and technical best practices\nDo these to reduce risk and support audits: maintain versioned runbooks and store code in source control; use managed identities/service principals with certificate-based auth for automation; implement a staged disable (notify → block → disable → delete) and keep auditable logs of each step; handle service accounts carefully — exclude known service principals or require owner‑approved exceptions; and include license‑removal logic only after verifying retention needs (mailboxes and OneDrive retention should be dealt with via retention policies, not blind deletion).\n\nCompliance tips and validation\nFor Compliance Framework evidence: retain runbook logs, change control approvals for policy settings and threshold changes, exception records, and periodic reports showing counts of disabled accounts and timelines. Test the automation in a staging tenant or with a scoped set of non‑production users. Provide your assessor with the automation design, code snippets, sample logs, and the schedule demonstrating repeatability against the policy.\n\nIn summary, meeting IA.L2-3.5.6 in Azure AD/Microsoft 365 is best achieved by a documented policy plus a scheduled, auditable automation pipeline that uses Microsoft Graph (or Azure AD tooling) to identify inactive identifiers and apply a staged deactivation workflow; combine automation with Access Reviews, HR integration, and retention policies to minimize business impact while maintaining a strong compliance posture."
  },
  "metadata": {
    "description": "Step‑by‑step guidance to automate disabling inactive Azure AD and Microsoft 365 user identifiers to meet NIST SP 800‑171 / CMMC IA.L2‑3.5.6 requirements, including technical examples, runbook patterns, and small‑business scenarios.",
    "permalink": "/how-to-automate-identifier-deactivation-in-azure-ad-and-microsoft-365-for-ial2-356-compliance-nist-sp-800-171-rev2-cmmc-20-level-2-control-ial2-356.json",
    "categories": [],
    "tags": []
  }
}