CyberCQRThought leadershipWorking togetherBook a conversation
Prefer a PDF? Download this paper with a verified work email address.
CYBERCQR

Temporary and Test Account Strategy for Microsoft Entra ID

Just-in-time activation for cloud-only accounts: disabled by default, enabled on request, expired automatically.

VERSION 1.0 |  07/10/2026
PART A — BOARD AND RISK COMMITTEE SUMMARY

1. Executive summary

Temporary and test accounts are among the least governed identities in most Microsoft Entra ID tenants. They are created quickly, rarely owned by a named person, and often left enabled long after the work has finished. Attackers look for exactly these accounts, because nobody notices when one of them signs in.

This strategy treats every temporary or test account as a dormant asset. Each account stays disabled until a named owner requests it for a fixed period, with a business reason and, where needed, an approval. When the period ends, the account is disabled again without anyone having to remember. The model mirrors Privileged Identity Management (PIM), which most organisations already use for administrator roles.

Microsoft does not offer this as a single product feature. It is assembled from standard Entra ID components plus a small amount of automation, and it can be delivered in four phases over roughly twelve weeks. Three licensing routes are set out, so the design can be adopted whether the organisation holds Entra ID P1, P2 or Entra ID Governance licences.

Decisions requested from the risk committee
  1. Approve the principle that temporary and test accounts are disabled by default and enabled only for a time-boxed, owned and logged window.
  2. Select a licensing route (section 8) and approve the associated cost.
  3. Agree the maximum activation period and the unused-account deletion threshold (section 7).

2. The problem

A test account exists to prove that something works. Once the test is complete, the account has no purpose, yet it normally remains enabled with a password that someone wrote down. A temporary account for a contractor or a migration behaves the same way. Over several years a tenant accumulates dozens or hundreds of these identities.

The risk has four parts, and each compounds the others:

An enabled account that nobody is using is pure exposure with no offsetting benefit. Reducing the time each account is enabled is therefore the single most effective control available.

3. Design principles

PrincipleWhat it means in practice
Disabled by defaultEvery temporary or test account is disabled unless an activation is in force.
Always ownedEvery account has one named, current employee as owner. An account without an owner is disabled and then deleted.
Time-boxedActivation lasts for a fixed period chosen at request time, up to an agreed maximum.
No standing credentialsThe owner receives a short-lived sign-in code at activation. No password is stored or shared.
No standing privilegeTest accounts never hold permanent administrator roles. Privilege needs a second, separate activation.
Born with an end dateEach account is created with an expiry date, and is deleted when that date passes unless renewed.
Tamper resistantOnly the automation and a small administrator group can change these accounts.
Fully evidencedEvery request, approval, enablement and expiry is logged and reportable.
Scope boundaries. Emergency access (“break-glass”) accounts are excluded and follow their own standard. Accounts used by scripts or applications should not be user accounts at all; they should be replaced by workload identities such as managed identities or service principals.
PART B — TECHNICAL DESIGN

4. Target architecture

The recommended design uses Entitlement Management, part of Entra ID Governance, as the request and approval front end. An access package represents “permission to have a test account active”. A custom extension links the access package to an Azure Logic App, which carries out the enablement and disablement through the Microsoft Graph Application Programming Interface (API). Microsoft documents custom extension triggers for when an assignment is granted and when it is removed, which map directly onto activation and expiry [1].

Account owner named employee My Access portal account, duration, justification Access package policy, approval, expiry Approver where required Logic App managed identity verify owner, enable, disable Restricted management administrative unit Test / temporary account disabled by default tagged, owned, end-dated Conditional Access device, location, session limits Reconciliation sweep hourly safety net Monitoring audit and sign-in log alerts 1 2 3 granted 5 removed 4 enable / 5 disable 4 temporary sign-in code
Figure 1. Target architecture. Solid lines show the activation path; the dashed orange line shows expiry. Numbers match the steps in section 5.

Components

ComponentRole in the design
Account taggingAn extension attribute (for example extensionAttribute10 = TESTACCT or TEMPACCT) identifies in-scope accounts. The manager attribute records the owner. A second extension attribute holds the account end date.
Restricted management administrative unitHolds all in-scope accounts. Only administrators with a role assigned at the scope of the unit can change the accounts inside it [3].
Access packageOne package per account class (test, temporary), held in a dedicated catalogue. It grants membership of a marker group and carries the request questions, approval and expiry policy.
Custom extension and Logic AppFires on “assignment granted” and “assignment removed” [1]. Runs under a system-assigned managed identity.
Temporary Access Pass (TAP)A time-limited passcode issued to the owner at activation. Removes the need for a stored password.
Conditional Access policyTargets a dynamic group of tagged accounts. Restricts device, location and session length.
Reconciliation sweepA scheduled job that disables any tagged account that is enabled without a current assignment.
MonitoringAlert rules over the Entra ID audit and sign-in logs, in Microsoft Sentinel or Log Analytics.

5. Request, enable and expire flow

The request model: owner requests for self

A disabled account cannot sign in to request its own activation, so the request has to come from a person. In the recommended model the owner requests the access package for themselves and names the target account in a request question. The Logic App then confirms that the requester is the recorded owner of that account before it acts.

This model has two practical advantages. Only the human owners need governance licences, not the test accounts. It also avoids making a disabled account the subject of an access request, a scenario that should not be assumed to work without testing.

The trade-off is that an owner holds one assignment per access package at a time. An owner who needs several accounts live together should be able to list more than one account in a single request, and the Logic App should handle a list.

Step by step

  1. Request. The owner opens the My Access portal, selects the package, and supplies the account name, the duration and a justification.
  2. Approve. Short activations of ordinary test accounts are auto-approved. Longer periods, or accounts with access to sensitive systems, route to an approver.
  3. Grant. Entitlement Management creates the assignment and calls the Logic App.
  4. Enable. The Logic App checks the tag and the owner, sets accountEnabled to true, creates a single-use TAP, and sends it to the owner over an authenticated channel. It writes a record of the activation.
  5. Expire. When the assignment ends, or the owner hands it back early, the Logic App sets accountEnabled to false, revokes sign-in sessions and deletes any remaining TAP.
  6. Reconcile. The hourly sweep catches anything the event-driven path missed.

Suggested activation tiers

TierDurationApprovalTypical use
ShortUp to 8 hoursAutomatic, justification requiredFunctional testing, reproducing a fault
StandardUp to 5 daysLine manager or service ownerTest cycle, user acceptance testing
ExtendedUp to 30 daysSecurity teamTemporary worker, migration project

Each tier is implemented as a separate assignment policy on the access package. Durations are starting points to be tuned to the organisation.

6. Guardrails

Containment

Place every in-scope account in a restricted management administrative unit. Tenant-wide administrators, including User Administrators, then lose the ability to enable the accounts or reset their credentials by hand. Assign the Logic App identity and a small break-fix group the roles they need at the scope of the unit only. The restricted setting must be chosen when the unit is created; it cannot be applied afterwards.

Conditional Access

Privilege

Temporary and test accounts hold no permanent directory roles or Azure role assignments. Where a test needs privilege, make the account eligible through PIM for Groups, so that privilege requires its own activation with its own time limit. Two independent time limits then apply: one for the account and one for the privilege.

Monitoring

AlertWhy it matters
Tagged account enabled by anything other than the automation identitySomeone has bypassed the process.
Sign-in by a tagged account with no active assignmentThe account should have been disabled; the control has failed or been evaded.
Role or privileged group assignment to a tagged accountStanding privilege is being introduced.
Tag, manager or administrative unit membership changedAn account may be leaving the control boundary.
New account matching the naming pattern but untaggedAn account was created outside the approved route.
Logic App run failuresAn expiry may not have been enforced.

7. Account lifecycle

Creation

Accounts are created through one route only: a request form or service desk item that captures the owner, purpose and end date. The automation creates the account in a disabled state, applies the naming convention (for example tst- and tmp- prefixes), sets the tag, and adds the account to the administrative unit. No password is issued.

Review

Owners confirm each quarter that their accounts are still needed. An access review is the natural mechanism where licensing allows; otherwise a scheduled report to each owner works. Accounts that are not confirmed are scheduled for deletion.

Ownership change

When an owner leaves or changes role, ownership passes to their manager for fourteen days. If nobody claims the account in that period, it is deleted.

Deletion

TriggerAction
End date reachedOwner notified 14 days before; account deleted on the date unless renewed.
No activation for 90 daysOwner notified; account deleted after a further 14 days.
No valid ownerAccount deleted after 14 days.

Deleted users remain recoverable in Entra ID for 30 days, which gives a safety margin for mistakes.

8. Licensing and cost options

The design can be reached by three routes. They differ in how polished the request experience is and how much custom automation the organisation has to own. Microsoft lists custom extensions for Entitlement Management among its Entra ID Governance features [4], so the recommended route needs that licence for the people who make requests.

Route A: GovernanceRoute B: P2Route C: P1
Request front endAccess package in My AccessPIM for Groups activationForm or service desk request
Approval and expiryNative, policy-drivenNative to PIMBuilt into the Logic App
Enable and disableEvent-driven via custom extensionScheduled job polling group membershipLogic App with a timed delay, plus sweep
LatencyNear real timeUp to the polling interval, typically 5 minutesNear real time to enable
Audit trailStrong, nativeStrong, nativeAdequate, custom
Custom code to maintainLowMediumHighest
Who needs the higher licenceAccount ownersAccount ownersNobody beyond P1

Route B in brief. Each owner is made eligible for a group that represents their test accounts. Activating the group membership in PIM is the request. A scheduled job reads group membership and enables or disables the matching accounts. The experience is familiar to anyone who already uses PIM, at the cost of a short polling delay.

Route C in brief. The guardrails in section 6 do most of the risk reduction and need only P1. The request and timing logic is entirely custom, so the organisation carries more build and support effort.

Licensing caveats. Conditional Access and dynamic group membership both assume P1 coverage for the accounts they apply to, so the test accounts themselves are not free of licensing implications. An alternative model in which a manager requests on behalf of the test account requires governance licences for both the requester and the target [2], which is why it is not recommended here. Microsoft licensing terms change; confirm entitlements with a licensing partner before committing budget.

9. Phased rollout

PhaseWeeksActivitiesExit criteria
0. Discover1–2Inventory candidate accounts by name pattern, sign-in history and licence. Identify owners. Disable accounts with no sign-in for 90 days.Every candidate account is classified, owned or disabled.
1. Contain3–4Apply tags. Create the restricted administrative unit, dynamic group and Conditional Access policy in report-only mode, then enforce. Remove standing roles. Stand up the monitoring alerts.All in-scope accounts are inside the control boundary with no standing privilege.
2. Automate5–8Build the catalogue, access package, custom extension and Logic App. Pilot with one team. Disable all pilot accounts by default. Build the reconciliation sweep.Pilot team activates and expires accounts with no manual intervention.
3. Govern9–12Extend to all teams. Close the old creation routes. Start quarterly reviews and automated deletion. Publish the standard and report metrics.No tagged account is enabled without an active assignment.

Phases 0 and 1 deliver most of the risk reduction and do not depend on the licensing decision. They can begin immediately.

Measures of success

10. Risks, assumptions and open decisions

ItemTypeTreatment
The automation identity can enable accounts and issue sign-in codes, so it becomes a high-value target.RiskUse a managed identity with no credentials to steal. Scope its roles to the administrative unit. Restrict who can edit the Logic App and alert on changes.
An expiry event is missed because the Logic App fails.RiskHourly reconciliation sweep and a failure alert.
Teams create untagged accounts to avoid the process.RiskRestrict user creation rights, detect by naming pattern, and make the approved route quick.
The sign-in code is intercepted on its way to the owner.RiskSingle-use code with a short lifetime, sent only over an authenticated internal channel.
Automated tests need accounts available without a human request.RiskMove these to workload identities, or allow the pipeline identity to hold the request role under the same time limits.
Request-question answers are passed to the Logic App in the custom extension payload.AssumptionConfirm in the pilot. If not, the Logic App reads the request through Microsoft Graph.
Graph application permissions alone are not sufficient to modify accounts inside a restricted administrative unit; a scoped role is needed.AssumptionConfirm in the pilot and record the final permission set.
Maximum activation period and deletion thresholds.DecisionRisk committee, with input from test and delivery leads.
Licensing route.DecisionRisk committee, following confirmation of current entitlements.
PART C — TECHNICAL ANNEX

11. Technical annex

The material below is a starting point for the build team. It has not been run against a live tenant and should be validated during the pilot.

11.1 Logic App outline

TRIGGER  Entitlement Management custom extension (HTTP request)
READ     stage, requester object ID, assignment end time, answers (target accounts)

FOR EACH target account
  GET    user: accountEnabled, extensionAttribute10, manager
  CHECK  tag is TESTACCT or TEMPACCT        else reject and alert
  CHECK  manager ID equals requester ID     else reject and alert

  IF stage = assignment granted
    PATCH  user: accountEnabled = true
    POST   temporaryAccessPassMethods: single use, short lifetime
    SEND   pass to requester over authenticated channel
    LOG    account, requester, justification, end time

  IF stage = assignment removed
    PATCH  user: accountEnabled = false
    POST   revokeSignInSessions
    DELETE any remaining temporaryAccessPassMethods
    LOG    account, requester, actual end time

11.2 Permissions for the automation identity

PurposeCandidate permission or role
Read users and managersUser.Read.All
Enable and disable accountsUser.EnableDisableAccount.All, or User Administrator scoped to the administrative unit
Issue and delete a TAPUserAuthenticationMethod.ReadWrite.All, or Authentication Administrator scoped to the administrative unit
Revoke sessionsUser.RevokeSessions.All

Prefer roles scoped to the administrative unit over tenant-wide application permissions wherever the pilot shows they are sufficient.

11.3 Dynamic group rule

(user.extensionAttribute10 -eq "TESTACCT") or (user.extensionAttribute10 -eq "TEMPACCT")

11.4 Reconciliation sweep logic

active  = target accounts named in current access package assignments
tagged  = users where extensionAttribute10 in (TESTACCT, TEMPACCT)

FOR EACH user in tagged
  IF user.accountEnabled AND user NOT IN active
    disable user, revoke sessions, raise alert "enabled outside process"
  IF user.manager is empty OR manager is disabled
    flag "no valid owner"
  IF end date has passed
    queue for deletion

11.5 Example detection queries (Kusto Query Language)

Enablement by anything other than the automation identity:

AuditLogs
| where OperationName in ("Enable account", "Update user")
| mv-expand prop = TargetResources[0].modifiedProperties
| where prop.displayName == "AccountEnabled" and prop.newValue has "true"
| extend target = tostring(TargetResources[0].userPrincipalName)
| where target startswith "tst-" or target startswith "tmp-"
| extend actor = coalesce(tostring(InitiatedBy.app.displayName),
                          tostring(InitiatedBy.user.userPrincipalName))
| where actor != "<automation identity name>"

Sign-ins by tagged accounts, for comparison against the activation log:

SigninLogs
| where UserPrincipalName startswith "tst-" or UserPrincipalName startswith "tmp-"
| project TimeGenerated, UserPrincipalName, AppDisplayName, IPAddress,
          ResultType, ConditionalAccessStatus

12. Glossary

TermPlain-language meaning
Access packageA bundle of access that a person can request for a set period through a self-service portal.
Administrative unitA container in Entra ID that limits which administrators can manage the accounts inside it.
Application Programming Interface (API)A way for one piece of software to instruct another.
Cloud-only accountAn account that exists only in Entra ID and is not copied from an on-premises directory.
Conditional AccessRules that decide whether a sign-in is allowed, based on who, where, and on what device.
Custom extensionA hook that lets Entitlement Management call an organisation’s own automation at set points.
Entitlement ManagementThe Entra ID feature that handles access requests, approvals and expiry.
Logic AppA Microsoft Azure service for building automated workflows without managing servers.
Managed identityAn identity for automation that Microsoft manages, with no password or key for anyone to steal.
Microsoft GraphThe interface through which software reads and changes data in Microsoft 365 and Entra ID.
Multi-Factor Authentication (MFA)Signing in with two or more proofs of identity, such as a password and a phone prompt.
Privileged Identity Management (PIM)The Entra ID feature that grants administrator rights only for a limited, requested period.
Temporary Access Pass (TAP)A passcode that works for a short time or a single use, issued in place of a password.
Workload identityAn identity used by software or a script instead of a person.

13. Bibliography

  1. Microsoft Learn. Trigger Logic Apps with custom extensions in entitlement management. https://learn.microsoft.com/en-us/entra/id-governance/entitlement-management-logic-apps-integration (accessed 07/10/2026).
  2. Microsoft Learn. Request access package on-behalf-of other identities. https://learn.microsoft.com/en-us/entra/id-governance/entitlement-management-request-behalf (accessed 07/10/2026).
  3. Microsoft Learn. Restricted management administrative units in Microsoft Entra ID. https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management (accessed 07/10/2026).
  4. Microsoft Learn. Microsoft Entra ID Governance licensing fundamentals. https://learn.microsoft.com/en-us/entra/id-governance/licensing-fundamentals (accessed 07/10/2026).