Join our Newsletter — 33% off our NHI Course
Home› Guides› How to detect interactive logons by service accounts:…
Guide SOC & Detection Engineering

How to detect interactive logons by service accounts: Windows events, rules and lockdown steps

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 11 November 2026 13 min read
On this page

A service account that signs in at a console or over Remote Desktop is almost never a service doing its job: it is a person, or an attacker, using a password that was meant only for software. Service accounts usually hold broad rights, rarely have MFA and often have passwords that have not changed in years, so interactive use is one of the cleanest identity signals a SOC can alert on. This guide shows how to build the list of service accounts to watch, which Windows and Entra ID events show interactive use, how to write and tune the rules, how to triage a hit and how to stop it happening with user rights assignments. It is for SOC analysts, detection engineers and Active Directory administrators. Logon types in general are explained in the Windows Logon Types and Authentication Events guide; this page is the focused detection runbook.

Key takeaways

  • Service accounts should only show network, batch or service logons: Microsoft's own hunting query treats an account with only logon types 3, 4 or 5 as a service account. Types 2, 7, 10, 11, 12 and 13 on such an account are the alert.
  • The list of accounts is the hard part: the rule is simple once you know which accounts are service accounts. Build the list from naming, SPNs, managed account types and observed behaviour, and keep it current.
  • Failures matter too: once you deny interactive rights, an attempt produces event 4625 with status 0xC000015B, "the user has not been granted the requested logon type", which is a high-confidence alert in itself.
  • Prevention is two user rights: Microsoft's countermeasure is to assign "Deny log on through Remote Desktop Services" to all service accounts; add "Deny log on locally" where the service does not need it.
  • Entra ID has the same problem: Microsoft recommends against using Entra user accounts as service accounts. Where they exist, any interactive sign-in in the sign-in logs deserves the same alert.

When you need this

  • Shared passwords: administrators who know a service account password and use it to "just fix something" on a server create exactly the activity an attacker hides behind.
  • After a credential exposure: service account passwords recovered by Kerberoasting or from scripts are used interactively for discovery and lateral movement. See the Kerberoasting and AS-REP Roasting Defence Guide.
  • Service account credentials on personal or user devices: the Okta support system breach began with a service account's credentials saved in an employee's personal browser profile. A sign-in by that account from a laptop is the signal. See the Okta Support System Breach 2023.
  • Before locking accounts down: a few weeks of detection output shows which service accounts are genuinely used interactively, so the deny rights do not break production.

Before you start

ItemSourceFields you need
Successful logonWindows Security log event 4624 (audit subcategory Audit Logon) on member servers, workstations and domain controllers; Sentinel SecurityEventLogon Type, New Logon Account Name and Security ID, Workstation Name, Source Network Address, Logon Process, Authentication Package, Elevated Token, Virtual Account
Failed logonEvent 4625Status and Sub Status, especially 0xC000015B, 0xC0000070, 0xC000006A
Endpoint logon telemetryDefender for Endpoint DeviceLogonEventsLogonType (Interactive, RemoteInteractive, Network, Batch, Service and cached variants), AccountName, AccountSid, RemoteIP, RemoteDeviceName, IsLocalAdmin
Cloud sign-insEntra ID interactive sign-in logs (SigninLogs) and non-interactive user sign-insUserPrincipalName, AppDisplayName, IPAddress, DeviceDetail, ConditionalAccessStatus
Service account listActive Directory, your inventory or CMDB, a SIEM watchlistsAMAccountName, SID, UPN, owner, servers where it should run
  • Audit policy: confirm Audit Logon success and failure is enabled on every server class, not only domain controllers. Domain controllers see Kerberos authentication, but the logon type is recorded on the machine where the session starts.
  • Coverage gap: Microsoft notes that DeviceLogonEvents is not collected from Windows 7 or Windows Server 2008 R2 devices. Use Security log forwarding there.
  • Test: with a test service account, start a service (type 5), run a scheduled task (type 4), map a share (type 3) and then sign in over RDP (type 10). Confirm each arrives in the SIEM with the logon type you expect.

Step 1: build the service account list

Use several sources and record which one found each account, because no single method is complete.

MethodFindsMisses
Naming convention (Microsoft suggests a prefix such as svc- and an owner in the description)Accounts created under the conventionOlder accounts and those named after people or applications
Accounts with a servicePrincipalNameAccounts used for Kerberos services such as SQL Server and IISAccounts used only for batch jobs or scripts
Managed account object types (gMSA, sMSA)Managed service accounts; their logons show Virtual Account = YesOrdinary user accounts used as services
Behaviour: accounts seen only in logon types 3, 4 and 5 over 30 daysUndocumented service accountsAccounts already misused interactively during the baseline
Service and task configuration on servers (the account each Windows service or scheduled task runs as)The exact host-to-account mappingApplication-level credentials in config files

Store the result as a watchlist with account SID, name, owner and the hosts where the account is expected. Matching on SID rather than name survives renames. For a fuller inventory method, see the How to build a service account inventory from Active Directory guide.

Step 2: write the detection rules

RuleLogicPriority (ours)
Interactive or RDP logon by a service account4624 with Logon Type 2, 10, 11 or 12 (or DeviceLogonEvents LogonType Interactive, RemoteInteractive or the cached variants) where the account is on the watchlistHigh
Unlock by a service accountLogon Type 7 or 13 for a watchlist accountHigh (a service account should never have a desktop to unlock)
Denied logon type4625 with status or sub status 0xC000015B for a watchlist accountHigh once deny rights are deployed
Logon from an unauthorised workstation4625 with 0xC0000070 for a watchlist account restricted with "Log On To"High
Service account on an unexpected hostType 3, 4 or 5 logon on a host not in the account's expected host listMedium
Bad password runsSeveral 4625 events with 0xC000006A for a watchlist account; Microsoft recommends monitoring all 4625 events for service accountsMedium (guessing, or a stale stored password)
Remote PowerShell by a service accountPowerShell commands whose parent is wsmprovhost.exe run by an account with no interactive history, as in Microsoft's published hunting queryMedium
Cloud interactive sign-inAny interactive sign-in in Entra ID for a user account flagged as a service account, especially to the Azure portal, Microsoft 365 web apps or from a new IPHigh
Privileged mismatchType 4 or 5 logon by a member of a domain administrative group, which Microsoft lists as a logon type mismatch to monitorHigh (fix the account, not the alert)

A starting query for Sentinel with Windows Security events, assuming a watchlist named ServiceAccounts with a Sid column:

let svc = _GetWatchlist('ServiceAccounts') | project Sid = tostring(Sid);
SecurityEvent
| where EventID == 4624
| where LogonType in (2, 7, 10, 11, 12, 13)
| where TargetUserSid in (svc)
| project TimeGenerated, Computer, TargetUserName, LogonType, IpAddress, WorkstationName,
    AuthenticationPackageName, ElevatedToken

The Defender for Endpoint version filters DeviceLogonEvents on ActionType == "LogonSuccess" and LogonType in ("Interactive", "RemoteInteractive", "CachedInteractive", "Unlock", "CachedRemoteInteractive", "CachedUnlock"), the set used in Microsoft's hunting query. Confirm column names and values in your own workspace before enabling: SIEM schemas and connectors differ.

Step 3: tune before you page anyone

  1. Run in report mode for two to four weeks and label every hit: genuine misuse, known administrative practice, or a mis-classified account.
  2. Remove mis-classified accounts from the watchlist only after confirming with the owner that the account is used by a person. If it is, it is not a service account and should be converted to a named account.
  3. Do not exclude by host. Excluding "the jump server" hides the exact place an attacker would use the account. Exclude specific account and host pairs with an expiry date and a ticket reference instead.
  4. Raise severity for privileged accounts: combine with Elevated Token = Yes, IsLocalAdmin = true or membership of administrative groups.
  5. Route alerts to the account owner as well as the SOC so every hit produces either a fix or an explanation.

Triage a hit

  • Who was at the keyboard? Find the source address and workstation, then the named user signed in on that source at the same time. A service account RDP session from an administrator's workstation is usually a shared password; from an unknown host it is an incident.
  • What did the session do? Process creation (4688 or DeviceProcessEvents) for the logon ID, new services or scheduled tasks, use of explicit credentials (4648) to reach other hosts.
  • Is the password known to too many people? Check the vault or password manager access log for who retrieved the credential recently.
  • Is it wider? Search the same account for any logon type on hosts outside its expected list, and the same source for other service accounts.

Respond and contain

  1. Preserve: export the logon events, process events and session details for the logon ID before changes.
  2. End the session on the host and, if misuse is confirmed or unclear, reset the account password and update every service that uses it in a planned sequence. See the Service Account Password Rotation Runbook Guide.
  3. Apply the deny rights (below) to the account so the same route fails next time and produces 0xC000015B.
  4. Hunt for persistence created by the session: services, tasks, new local administrators and changes to the account's own group memberships.
  5. Rollback: if a deny right breaks a legitimate dependency, remove the account from that one GPO, record the exception with an owner and expiry, and keep the detection rule enabled for it.

Lock it down

ControlSettingEffectCaution
Deny log on through Remote Desktop ServicesSeDenyRemoteInteractiveLogonRight, Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights AssignmentBlocks RDP logons; Microsoft's stated countermeasure is to assign it to all service accountsSupersedes the matching Allow right
Deny log on locallySeDenyInteractiveLogonRight, same pathBlocks console logonsNever apply to Everyone; test with the Allow log on locally setting; a few components need local logon
Log On To (workstation restriction)Account property in Active DirectoryLimits the computers the account can authenticate to; violations log 0xC0000070Must list every host the service runs on
Group managed service accountgMSA with automatic password managementNo human knows the password, so interactive misuse needs host compromiseApplication must support it. See How to convert AD service accounts to gMSA
Entra workload identitiesManaged identity or service principal with a certificateNo interactive sign-in path at allRequires application change
  • Rollout: create a "Service accounts: deny interactive" group, link a GPO with both deny rights to a pilot OU of servers, add accounts that showed no interactive use during tuning, then widen by server tier. Changes apply at the account's next logon, with no restart.
  • Small organisations: a single GPO with both deny rights and a watchlist of fewer than a hundred accounts is enough; review it quarterly.
  • Large organisations: drive group membership from the inventory so new service accounts are denied by default, and track exceptions with expiry dates.

Verify it worked

  • Positive test: from a test host, attempt an RDP session with a test account on the watchlist before the deny rights apply. The Interactive or RDP rule should fire with the source address and logon type 10.
  • Blocked test: repeat after the GPO applies. The session must fail, and 4625 with 0xC000015B must arrive in the SIEM and raise the denied logon type alert.
  • Service still runs: restart the services and scheduled tasks that use the account and confirm type 5 and type 4 logons still succeed, so the lockdown has not broken production.
  • Cloud test: sign in interactively with a test Entra account tagged as a service account and confirm the cloud rule fires; then confirm a Conditional Access policy or account change blocks the next attempt if you chose to block.
  • Regression: keep these tests as a scheduled check, so a change to audit policy, log forwarding or the watchlist that silently breaks detection is caught.

Measures that show it is working

  • Interactive logons by watchlist accounts per month, trending to zero.
  • Percentage of service accounts covered by both deny rights.
  • Percentage of service accounts that are gMSA, managed identity or service principal rather than user accounts.
  • Service accounts found by behaviour that were missing from the inventory.
  • Median time from alert to owner response.

Common failure patterns

  • Watching names, not SIDs: renamed accounts drop out of the rule.
  • Logging only on domain controllers: the logon type is recorded on the target host; without member server logs you see authentication but not the RDP session.
  • Accepting "we always RDP as the service account": this is the practice to remove, not to exclude.
  • Deny rights without detection: blocked attempts (0xC000015B) are evidence of someone holding the password and should be alerted, not just prevented.
  • Forgetting the cloud side: on-premises rules miss an Entra user account used as a service account signing in to the portal.

Framework mapping

FrameworkReferenceHow this supports it
MITRE ATT&CK v20T1078.002 Domain Accounts; T1078.003 Local Accounts; T1021.001 Remote Desktop ProtocolDetects valid service account credentials used for access and lateral movement
NIST SP 800-53 Rev 5AC-2(11) Usage Conditions; AC-2(12) Account Monitoring for Atypical Usage; AC-6 Least Privilege; AU-6 Audit Record Review, Analysis, and ReportingRestricts how service accounts may be used and monitors deviations
NIST CSF 2.0PR.AA-01; PR.AA-05; DE.CM-03Managed non-human identities, enforced permissions, activity monitoring

Practitioner checklist

  • Enable Audit Logon success and failure on all servers and forward 4624 and 4625.
  • Build a service account watchlist by SID from naming, SPNs, managed types, behaviour and service configuration.
  • Alert on logon types 2, 7, 10, 11, 12 and 13 for watchlist accounts.
  • Alert on 4625 with 0xC000015B and 0xC0000070 for watchlist accounts.
  • Add Entra interactive sign-ins by user-based service accounts.
  • Tune in report mode with owners, then page on High rules.
  • Assign Deny log on through Remote Desktop Services and Deny log on locally through a pilot-first GPO.
  • Move accounts to gMSA, managed identities or service principals where possible.

Standards and references

Related NHI Mgmt Group resources: Top 10 Service Account Mistakes · Service Account Security Guide · Windows Logon Types and Authentication Events · Group Managed Service Accounts (gMSA) Guide · How to find service accounts with Domain Admin rights

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 11 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.