Join our Newsletter — 33% off our NHI Course
Home› Guides› How to audit ServiceNow MID Server service accounts…
Guide Non-Human Identity (NHI)

How to audit ServiceNow MID Server service accounts and discovery credentials: inventory, scoping and hardening steps

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 28 November 2026 14 min read
On this page

A ServiceNow MID Server sits inside your network holding the domain, SSH, SNMP and cloud credentials that Discovery uses to log in to almost everything you own. The instance hands those credentials to the MID Server on request, the MID Server keeps its own login to the instance in a local file, and the Windows service account it runs as often has more rights than anyone remembers granting. This guide is a step-by-step audit of that on-premises credential estate: the Credentials table, how credentials are scoped to MID Servers, external vault storage, the host the MID Server runs on, and the logs that show which credential was used where. It is for ServiceNow platform owners, ITOM engineers and identity teams. How integration users, OAuth clients and the MID Server user's instance roles should be configured is covered in the ServiceNow Integration Users and OAuth Security Guide; this page starts where that one stops.

This is an independent guide from NHI Mgmt Group, based on ServiceNow's public documentation as of November 2026. It is not sponsored or reviewed by ServiceNow. Product features change, so confirm settings against ServiceNow's current documentation for your release.

Key takeaways

  • Three identities, not one. Each MID Server has an instance login (stored in config.xml), an operating system service account, and access to the discovery credentials in the discovery_credentials table. Audit all three together.
  • Scope every credential. The credential form's Applies to and MID servers fields limit which MID Servers can use a credential; a credential left available to all MID Servers is reachable from every host that runs one.
  • Admin is often avoidable. ServiceNow documents Windows Discovery with a domain user holding local administrator rights, domain administrator only in cases such as domain controllers, and a non-administrator option through Microsoft Just Enough Administration (JEA).
  • Vault where you can. With external credential storage, the instance keeps only an identifier and the MID Server resolves the secret from your vault at run time, so the instance no longer holds the password.
  • Turn on the command audit log. The property mid.log.command_audit.enable records commands each MID Server runs and, per the Security Center check, the credential name used, which is the evidence an audit needs.

What the MID Server holds

A MID Server (Management, Instrumentation and Discovery server) is a Java application installed on a customer host. It polls the instance's ECC queue (External Communication Channel) for work, runs probes and patterns against targets, and returns results. That design concentrates credentials in one place. The table below is the scope of this audit.

CredentialWhere it livesWhat it reachesAudit question
MID Server instance userconfig.xml on the host, encrypted at rest by the configured providerThe ServiceNow instanceIs it unique per MID Server, Web Service Access Only and limited to the mid_server role? (see the integration guide)
Windows service accountWindows service configuration on the hostThe local host, and network resources if it is a domain accountIs it a dedicated account, and is it ever reused as a Discovery credential?
Windows discovery credentialsdiscovery_credentials (or an external vault)Every Windows host in the scanned rangesLocal admin, domain admin or JEA? Scoped to which MID Servers?
SSH credentials (password or private key)discovery_credentials (or vault)Linux and UNIX hosts, network devicesRoot, or non-root with a limited sudo rule?
SNMP credentialsdiscovery_credentialsSwitches, routers, printers, appliancesRead-only, and SNMPv3 rather than community strings?
Cloud and API credentialsdiscovery_credentials or a vault integrationCloud accounts and management APIsRead-only roles? Who owns them on the cloud side?
Database, VMware and application credentialsdiscovery_credentialsvCenter, databases, middlewareRead-only? Still needed?

ServiceNow describes the transport this way: discovery credentials are stored in an encrypted field, and when a MID Server asks for them the instance decrypts them and re-encrypts them with that MID Server's public key, so only that MID Server's private key can open them. The consequence for an auditor is simple: anyone who controls a MID Server host and its key can use every credential that MID Server is allowed to fetch. The MID Server's scope is the blast radius.

Before you start

  • Access: read access to the Credentials list (All > Discovery > Credentials), the MID Server list (ecc_agent), MID Server properties, and the command audit log, which needs the agent_security_admin role. Read-only access to each MID Server host's local groups and services.
  • People: the ITOM or Discovery owner who knows which schedules use which credentials, the Windows and Linux platform owners whose accounts are stored, and the network team for SNMP.
  • Change window: narrowing a credential can break a Discovery schedule. Agree a window and a rollback (re-add the MID Server or restore the old account rights) before you touch anything.

Step-by-step audit

  1. Inventory MID Servers. Export the MID Server list with host name, status, version, last refresh and the user each one authenticates as. Flag servers that are down or not validated: ServiceNow's MID Server Governance feature can invalidate and shut down inactive MID Servers after a timeout, so check whether it is configured. A retired MID Server whose host still exists is a credential holder with nobody watching it.
  2. Export the Credentials table. From discovery_credentials export name, type, active flag, user name, Applies to, MID servers, Order, Credential alias, External credential store and Credential ID. Passwords are not readable after entry, which is expected.
  3. Map each credential to an account and owner. For every user name, find the directory or device account, its group memberships and its owner. Domain accounts go into your service account inventory; see How to build a service account inventory from Active Directory.
  4. Check privilege per type. Use the table in the next section. Pay most attention to Windows credentials in Domain Admins or similar groups, SSH credentials using root, and SNMP communities with write access.
  5. Check scoping. List credentials with Applies to set to all MID Servers. For each, ask whether every MID Server needs it. A DMZ MID Server rarely needs the credential for internal domain controllers. Note that ServiceNow states the MID servers field does not affect MID Server selection and is not supported in Orchestration activities, so scoping is a credential control, not a routing control.
  6. Check aliases and order. Credentials with a Credential alias should be used only by the workflow or pattern that names the alias. Review Order: ServiceNow tries credentials in order and, without an order, at random until one works, so a broad credential with a low order number is tried against many hosts and can trigger lockouts on accounts with strict policies.
  7. Use affinity to find dead credentials. After a successful login, Discovery records the credential and device pairing in dscy_credentials_affinity. A credential with no affinity records is a candidate for deactivation; one with affinity to far more hosts than expected is a scoping problem.
  8. Inspect each MID Server host. Record the service account (it may be a credential with Windows MID Server Service Account set), local administrators, who can log on interactively, and file permissions on the install folder. ServiceNow advises limiting OS access to a few trusted administrators and monitoring OS logs for attempts to access config.xml, which holds the MID Server's instance user name and password.
  9. Check how config.xml secrets are protected. ServiceNow documents the default encryptor, Windows DPAPI (tied to the service account, so a changed account means re-encryption), a custom encrypter, CyberArk, or a custom external provider, one provider at a time. Record which one each MID Server uses. If the MID Server supports mutual TLS or IPKI authentication on your release, note whether it is used instead of a stored password.
  10. Check key age. ServiceNow states that MID Servers should be rekeyed periodically. Record the last rekey date per MID Server and add it to your rotation schedule.
  11. Check external storage status. If the External Credential Storage plugin is active, confirm com.snc.use_external_credentials is true. ServiceNow notes that disabling it sets external credentials inactive and re-enabling it does not reactivate them, which makes a quietly toggled property easy to spot as a mass of inactive records.
  12. Write findings with an owner and date. One row per credential: keep, narrow, move to vault, or deactivate.

What good looks like by credential type

TypeDocumented minimumBetter optionWatch for
WindowsDomain user with local administrator on targets; domain admin only where needed, such as domain controllersNon-administrator account through Microsoft JEA over WinRM (5985/5986), with mid.windows.management_protocol set to WinRM and mid.powershell.jea.endpoint set to the registered endpointOne domain admin credential used for every Windows target; the service account doubling as a Discovery credential
Linux and UNIX (SSH)Non-root user using sudo for the commands Discovery lists, or rootNon-root with a sudo rule limited to the documented commands; key-based authentication with the private key in a vaultRoot password stored; one key trusted on every host
SNMPRead access to the device MIBs Discovery queriesSNMPv3 with authentication and privacy, read-only viewv1 or v2c community strings with write access, or the same string everywhere. See the SNMP Security Guide.
CloudRead access to the resources discoveredRead-only role per account, secret in a vault integrationContributor or owner roles granted to make Discovery "just work"
VMware and databasesRead-only accessRead-only role, scoped to the inventory neededAdministrator accounts reused from build tooling

ServiceNow's JEA page notes that the MID Server and targets must be in a Windows domain, that the credential must be domain-level, and that the older sample profile in KB0782125 is no longer supported in favour of KB0965705. Plan JEA as a project with a pilot range rather than a single change.

Decision guidance: instance store or external vault

FactorInstance credential storeExternal credential storage
Where the secret livesEncrypted field on the instanceYour vault; the instance keeps an identifier, type and affinities
How the MID Server gets itDownloads it, re-encrypted to the MID Server's public keyA customer-supplied Credential Resolver JAR on the MID Server fetches it per probe or pattern
RotationUpdate the record in ServiceNow after each changeRotate in the vault; nothing to change in ServiceNow
Caching on the MID ServerAs delivered by the instanceServiceNow states the built-in CyberArk resolver caches for up to several seconds, encrypted in process memory; other resolvers vary
Fits bestSmall estates, few credentials, no enterprise vaultOrganisations with a PAM vault and rotation policies, or regulated estates

Both methods can run at the same time, so a common path is to move the most privileged credentials (domain, root, cloud) to the vault first and leave low-risk read-only ones in the instance. Supported vaults differ between releases: one release's credential form names CyberArk as the only supported system, while other pages describe a resolver model and an Azure Key Vault integration. Check the documentation for your release. For the vault side, see the Privileged Access Management Guide.

Small and large estates: a single-MID estate gains most from removing domain admin and turning on the command audit log. A large estate with MID Servers per network zone gains most from strict per-MID scoping, because one compromised zone host should not unlock credentials for the others.

Detection and measurement

  • Command audit log: set mid.log.command_audit.enable to true and restart the MID Server. Records include the command name, a hash of the script content (renaming a script does not change it), execution status and, where used, the JEA profile. The table rotates every seven days by default, so forward it to your SIEM if you need longer evidence.
  • Directory logs for Discovery accounts: a Discovery credential should log on from MID Server hosts only. Alert on logons from anywhere else and on interactive logons; see How to detect interactive logons by service accounts.
  • Credential record changes: monitor creates, updates and changes to Applies to on discovery_credentials, and changes to com.snc.use_external_credentials.
  • Host signals: access attempts on config.xml, new local administrators, and changes to the MID Server service account.
  • Resolver errors: lines beginning Problem with client's CredentialResolver: in the MID Server log show vault failures, which often precede someone "temporarily" putting a password back in the instance.
MetricTarget
Credentials with Applies to set to all MID ServersOnly those genuinely needed everywhere, each justified
Windows Discovery credentials in domain admin groupsOnly for domain controller ranges, or none with JEA
Privileged credentials held in an external vaultRising each quarter towards all domain, root and cloud credentials
Active credentials with no affinity records in 90 daysZero (deactivate or justify)
MID Servers with command audit logging on100%
MID Servers rekeyed within your policy period100%

Framework mapping

FrameworkReferenceHow this audit supports it
NIST CSF 2.0PR.AA-01, PR.AA-05, DE.CM-03Discovery identities managed and owned; least privilege; monitoring of their use
NIST SP 800-53 Rev. 5IA-5, AC-6, CM-6, AU-12, AU-6Authenticator protection and rotation; least privilege; MID host configuration; command audit records and review
CIS Controls v8.15.5 Establish and Maintain an Inventory of Service Accounts; 5.4 Restrict Administrator Privileges to Dedicated Administrator AccountsCredential inventory with owners; removing admin rights from Discovery accounts
ISO/IEC 27001:2022 Annex AA.5.17 Authentication information; A.8.2 Privileged access rights; A.8.15 LoggingSecret storage and vaulting; privilege review; command audit evidence
MITRE ATT&CKT1552.001 Credentials In Files; T1078.002 Domain Accounts; T1021.004 SSHSecrets in config.xml; misuse of Discovery domain accounts; lateral movement with stored SSH credentials

Where identity fits

Every Discovery credential is a non-human identity with an owner who is often the person who set up Discovery years ago. Treat them like any other service account: inventory, owner, purpose, rotation and access review. Accounts shared between Discovery and other tools are a common finding; split them using How to find service accounts shared by several applications or hosts and split them, and include them in service account access reviews.

Common failure patterns

  • One domain admin for everything. Discovery was set up with a domain admin to avoid access errors, and it is now tried against every Windows host in every range. Replace it with local admin through a group, or JEA, and keep domain admin, if needed at all, to domain controller ranges.
  • Every credential available to every MID Server. The default of all MID Servers makes a low-trust zone host as powerful as a core one. Scope by zone.
  • Service account reuse. The MID Server's Windows service account is also a Discovery credential, so whoever controls the service controls the credential and its logons look normal.
  • Forgotten MID hosts. A decommissioned MID Server is removed from the instance list, but the host, its config.xml and its key remain. Include host disposal in MID Server retirement.
  • Vault half-adopted. Privileged credentials moved to a vault, then copied back into the instance during a resolver outage and never removed. Compare vault-backed and instance-stored credentials each quarter.
  • Audit log on, nobody reading it. With seven-day rotation, evidence of a misused credential can be gone before anyone looks. Forward it.

Practitioner checklist

  • Export MID Servers and discovery_credentials, and map every credential to an account and an owner.
  • Remove domain admin from Windows Discovery credentials except where documented as needed, and pilot JEA.
  • Replace root SSH credentials with non-root accounts and limited sudo rules.
  • Move SNMP to v3 read-only and remove write communities.
  • Scope each credential to the MID Servers that need it and justify every all-MID credential.
  • Deactivate credentials with no affinity records in 90 days, after confirming with the owner.
  • Give each MID Server a dedicated service account that is never a Discovery credential, and restrict host access.
  • Record the config.xml protection method and rekey MID Servers on a schedule.
  • Move domain, root and cloud credentials to an external vault where supported.
  • Enable mid.log.command_audit.enable on every MID Server and forward the log to the SIEM.

Standards and references

Related NHI Mgmt Group resources: ServiceNow Integration Users and OAuth Security Guide · ServiceNow Security Guide · How to find service accounts with Domain Admin rights · Secrets Management Guide

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.

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 both boxes to continue.