When it is written
Certificate templates are objects in Active Directory, and an enterprise certification authority (CA) loads the templates it issues. Microsoft documents that the CA writes 4899 to its own Security log when a template it has loaded has an attribute updated and an enrollment is then attempted for that template. The event is therefore written at the first enrollment after the change, not when the template is edited, and a template changed back before anyone enrolls leaves no 4899. It carries the template's name, version, schema version, OID and distinguished name, the domain controller the CA read it from, and the template content before and after the change.
The event names no account: the edit itself is a directory change, which domain controllers record as 5136 when the Certificate Templates container has a matching auditing entry. Standalone CAs do not use templates and do not write it. A change of the template's permissions writes 4900 instead.
How to turn it on
Advanced audit policy subcategory Audit Certification Services, Success and Failure. Set it in a Group Policy object linked to the computers that write the event:
Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > Audit Policies > Object Access > Audit Certification Services| Computer | Audit | Note |
|---|---|---|
| Domain controllers | Success if needed and Failure if needed | Microsoft marks every column "IF" (the same in its general and stronger baselines). Enable the subcategory when the server has the Active Directory Certificate Services role installed and you need to monitor AD CS events. |
| Member servers | Success if needed and Failure if needed | Microsoft marks every column "IF" (the same in its general and stronger baselines). Enable the subcategory when the server has the Active Directory Certificate Services role installed and you need to monitor AD CS events. |
| Workstations | Not logged | Microsoft says the AD CS role cannot be installed on a client operating system. |
auditpol /get /subcategory:"Certification Services"auditpol /set /subcategory:"Certification Services" /success:enable /failure:enableauditpol /get /subcategory:"{0CCE9221-69AE-11D9-BED3-505054503030}"Run the commands in an elevated prompt on a computer that writes the event. Subcategory settings take effect only when the security option Audit: Force audit policy subcategory settings (Windows Vista or later) to override audit policy category settings is enabled (the default), and a Group Policy object that sets advanced audit policy replaces local changes at its next refresh. Microsoft's advanced audit policy reference
Three settings must all be on, on every enterprise CA server:
- The Audit Certification Services subcategory, Success and Failure (Microsoft's PKI monitoring guide asks for both).
- The Change CA security settings category in the CA's own audit filter: the Auditing tab of the CA's properties in the Certification Authority console, or bit value
16of the CA'sAuditFilterregistry value (all seven categories together are127). Microsoft's event table names this category; its monitoring guide calls it "Change CA settings" in the same place. - The policy module flag EDITF_AUDITCERTTEMPLATELOAD, which Microsoft's monitoring guide sets with
certutil -setreg policy\EditFlags +EDITF_AUDITCERTTEMPLATELOAD. Restart Certificate Services afterwards, as for the audit filter.
The same settings produce 4898 (the CA loaded a template) and 4900 (template security updated).
Fields
In Event Viewer order. The field names are those of the event XML, from the event template that ships with Windows.
| Field | What it holds | Since |
|---|---|---|
TemplateInternalName | Internal name of the template (the cn of the template object), shown before the version in the message. | v0 |
TemplateVersion | Version of the template, shown after "v" in the message. A template object keeps its major version in the revision attribute and its minor version in msPKI-Template-Minor-Revision. | v0 |
TemplateSchemaVersion | Schema version of the template (msPKI-Template-Schema-Version), shown after "Schema V" in the message. | v0 |
TemplateOID | Object identifier of the template (msPKI-Cert-Template-OID). | v0 |
TemplateDSObjectFQDN | Distinguished name of the template object in the configuration partition, below CN=Certificate Templates,CN=Public Key Services,CN=Services. Use it to find the 5136 events of the change. | v0 |
Old Template ContentOldTemplateContentTemplate Change Information | The template's attributes as the CA had loaded them before the change (shown as Old Template Content). Compare it with NewTemplateContent to see what changed. | v0 |
New Template ContentNewTemplateContentTemplate Change Information | The template's attributes after the change, as text (shown as New Template Content). Microsoft does not document the layout, so check an event from your own CA before you parse it. | v0 |
Domain ControllerDCDNSNameAdditional Information | DNS name of the domain controller the CA read the template from (shown as Domain Controller). | v0 |
Values to know
New Template Content NewTemplateContent
| Value | Meaning | Signal |
|---|---|---|
Enrollee supplies subject (SubjectNameEnrolleeSupplies, 0x1 in msPKI-Certificate-Name-Flag) | The requester chooses the subject of the certificateOn a template whose certificates authenticate, the requester can name another account. Microsoft's PKI guide lists templates that allow "supply in request" among the changes to monitor. | Attack signal |
A new extended key usage: client authentication (1.3.6.1.5.5.7.3.2), smart card logon (1.3.6.1.4.1.311.20.2.2), certificate request agent (1.3.6.1.4.1.311.20.2.1), code signing (1.3.6.1.5.5.7.3.3) or any purpose (2.5.29.37.0) | The certificates gain a sensitive use | Attack signal |
Manager approval removed (EnrollmentPendAllRequests, 0x2 in msPKI-Enrollment-Flag) or fewer authorized signatures (msPKI-RA-Signature) | Requests are no longer reviewed before issuance | Attack signal |
A new minor version, validity period or key size | Routine template maintenance | Expected |
TemplateInternalName
| Value | Meaning | Signal |
|---|---|---|
A template whose certificates authenticate (user, smart card logon, domain controller) or act for others (enrollment agent) | Changes here affect sign-in or enrollment on behalf of othersReview these first. | Attack signal |
Other templates | Server, encryption or signing templates | Worth knowing |
Volume and noise
Low. One event per changed template, at the first enrollment after the change. Template maintenance by PKI administrators (a new minor version, a longer validity period, new enrollment permissions handled by 4900) is the usual source. Microsoft rates the event medium.
Keeping it manageable
- Keep every event: the volume is low and the rule matches on the event ID alone.
- Compare
OldTemplateContentwithNewTemplateContentand raise the priority for the changes Microsoft's PKI guide names: new extended key usages (code signing, enrollment agent, smart card logon), or a template that now lets the enrollee supply the subject. - Match each event with the 5136 events for the same template object (
TemplateDSObjectFQDN) on the domain controllers, which give the account and the time of the change.
Sample event
Version 0, with made-up values.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Security-Auditing" Guid="{54849625-5478-4994-a5ba-3e3b0328c30d}" />
<EventID>4899</EventID>
<Version>0</Version>
<Level>0</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8020000000000000</Keywords>
<TimeCreated SystemTime="2026-11-18T09:30:12.4567890Z" />
<EventRecordID>1048576</EventRecordID>
<Correlation />
<Execution ProcessID="712" ThreadID="2408" />
<Channel>Security</Channel>
<Computer>CA01.corp.example.com</Computer>
<Security />
</System>
<EventData>
<Data Name="TemplateInternalName">CorpWebServer</Data>
<Data Name="TemplateVersion">100.5</Data>
<Data Name="TemplateSchemaVersion">2</Data>
<Data Name="TemplateOID">1.3.6.1.4.1.311.21.8.4718251.2013977.12519542.9831145.8806221.240.1846272.6034531</Data>
<Data Name="TemplateDSObjectFQDN">CN=CorpWebServer,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=corp,DC=example,DC=com</Data>
<Data Name="DCDNSName">DC01.corp.example.com</Data>
<Data Name="NewTemplateContent">pKIExpirationPeriod = 2 Years
pKIExtendedKeyUsage = 1.3.6.1.5.5.7.3.1 Server Authentication
msPKI-Certificate-Name-Flag = 0x1
msPKI-Template-Minor-Revision = 5</Data>
<Data Name="OldTemplateContent">pKIExpirationPeriod = 1 Years
pKIExtendedKeyUsage = 1.3.6.1.5.5.7.3.1 Server Authentication
msPKI-Certificate-Name-Flag = 0x1
msPKI-Template-Minor-Revision = 4</Data>
</EventData>
</Event>Attacks this event reveals
Detection rules that read this event:
Frequently asked questions
Why is event 4899 written long after the template was changed?
Microsoft documents that the CA writes it when a template it has loaded was updated and an enrollment is then attempted for that template. The event marks the first use of the changed template on that CA, which can be days after the edit, and a change that is reverted before anyone enrolls produces no 4899 at all.
Does 4899 show who changed the template?
No. The event has no account fields. The template is an Active Directory object, so the domain controllers record the change as 5136 with the account, provided the Certificate Templates container has an auditing entry. TemplateDSObjectFQDN gives the object to search for.
Why does our CA never write 4899?
The event needs the Audit Certification Services subcategory, the "Change CA security settings" category in the CA's audit filter and the policy module flag EDITF_AUDITCERTTEMPLATELOAD, then a restart of Certificate Services. It is written only on enterprise CAs, and only when a changed template is used for an enrollment.
What is the difference between 4899 and 4900?
4899 records a change of the template's attributes (its settings), 4900 a change of its security descriptor (who may enroll in it, edit it or own it). Both come at the first enrollment after the change.
References
- Securing PKI: Monitoring Public Key Infrastructure (Microsoft)
- Securing PKI: Appendix A: Events to Monitor (Microsoft)
- Audit Certification Services (Microsoft)
- Securing PKI: Appendix B: Certification Authority Audit Filter (Microsoft)
- X509CertificateTemplateSubjectNameFlag enumeration (Microsoft)
- X509CertificateTemplateEnrollmentFlag enumeration (Microsoft)
- PKI-Certificate-Template class (Microsoft)
- ObjectIdGroupId enumeration (extended key usage OIDs, Microsoft)
- RFC 5280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile