Certdog ADCS (Microsoft CA) Agent

From version: 1.18.0

The ADCS Agent is the component that connects certdog to Microsoft CAs (Active Directory Certificate Services)

It replaces the ADCS Driver. The driver still works and existing installations carry on unchanged after an upgrade, but new installations should use the agent. To move from the driver to the agent see Migrating from the ADCS Driver below

You only need the agent if you intend to use Microsoft CAs. If you are only using certdog’s own local CAs, or EJBCA, it does not need to be installed

How it Works

The agent is a Windows service. It can be installed on the certdog server, on the CA server itself, or on any other Windows server that can reach the CA

  • The agent connects out to certdog over HTTPS (the same address and port the certdog UI uses). Nothing connects in to the agent, so no inbound firewall rule is needed on the server it runs on
  • The agent does not connect to the certdog database. Port 27017 does not need to be opened (this was required for the ADCS Driver)
  • Each agent has its own key, which is created on the server it is installed on and cannot be copied from it. An administrator approves each agent in certdog before it is allowed to connect
  • The agent only connects to a certdog server whose TLS certificate it trusts. See TLS Certificates below
  • Multiple agents can be installed, in the same and in different domains. More than one agent can be selected for a Certificate Issuer, in which case any one that is connected and free will process each request

With the agent, certdog can:

Requirements

  • Windows Server 2019, 2022 or 2025
  • A server that can reach the Microsoft CA. This is normally a server in the same domain as the CA, or the CA server itself
  • The server must be able to connect to certdog on its HTTPS port (443 by default)
  • The server must trust certdog’s TLS certificate. See TLS Certificates

Nothing else needs to be installed. The agent includes its own .NET runtime

You will normally also require a service account with the required permissions to access your Microsoft CA. See the Service Account section below

Installing on the certdog Server

This is the simplest option and can be used when the certdog server is in the same domain as the Microsoft CA

When certdog is installed you will be asked:

The Certdog ADCS Agent connects certdog to Microsoft CAs (Active Directory Certificate Services).
It is only required if you intend to issue certificates from, or sync with, a Microsoft CA.
It is not needed for local CAs or EJBCA.

It can also be added later: on this machine by running .\install-adcs-service.ps1, or on another
server (such as the CA server) by copying the certdog\agents\adcs-agent folder to it.
Install the Certdog ADCS Agent on this machine (y/n)?

Enter y to install the agent. The agent will only be installed if you enter y

If you did not install the agent at that time, or you have upgraded from an earlier version, it can be installed later. Open a PowerShell window as Administrator, navigate to the .\certdog\install directory and run:

.\install-adcs-service.ps1

When installed this way the agent is registered and approved automatically. There is no registration code to enter and nothing to approve in certdog. This is because the installer has just installed the agent itself, on the same machine

The agent connects to certdog at https://127.0.0.1

The temporary TLS certificate

A new installation of certdog uses a temporary TLS certificate (see Configure Server SSL). Windows does not trust this certificate, and the agent will not connect to a server it does not trust. The installer will therefore display a warning and ask:

WARNING: this machine does not trust certdog's TLS certificate

The agent only connects to a certdog whose TLS certificate this machine trusts. certdog is using the
temporary certificate created by this installation. Its root certificate is:
  C:\certdog\config\sslcerts\tls_root.cer

You can either:
  - add that root to this machine's Trusted Root Certification Authorities now, so the agent connects
    straight away, or
  - leave it, and give certdog a TLS certificate your organisation already trusts. The agent is
    installed and keeps trying, and connects once certdog has that certificate

Add the temporary root to this machine's Trusted Root Certification Authorities (y/n)?
  • Enter y and the temporary root certificate is added to this machine’s Trusted Root Certification Authorities store. The agent will connect straight away

  • Enter n and nothing is added. The agent is still installed but will not connect. It will keep trying, and will connect by itself once certdog has been configured with a TLS certificate that this machine trusts. See TLS Certificates below

The root certificate is never added unless you enter y

Unattended installation

If certdog is being installed with parameters (see Installation) the following switches apply:

  • -installAdcsAgent installs the agent without asking
  • -trustTlsRootCertificate also adds the temporary root certificate to the Trusted Root Certification Authorities store. Without this switch the root certificate is not added

Installing on Another Server

The agent can be installed on any other Windows server, such as the CA server itself or a server in another domain. Any number of agents can be installed

The steps are:

  1. Copy the agent’s folder to the server
  2. Create a registration code in certdog
  3. Run the install script on the server
  4. Approve the agent in certdog

1. Copy the Folder

From the certdog installation, copy this folder to the server the agent is to be installed on:

.\certdog\agents\adcs-agent

It contains everything that is required:

File Description
install-certdog-adcs-agent.ps1 Installs the agent, then runs the configure script
configure-certdog-adcs-agent.ps1 Registers the agent with certdog. Can also be run by itself later to change settings or check the agent’s status
CertdogAdcsAgent.msi The agent
README.txt A short version of this guide

2. Create a Registration Code

Log in to certdog as an administrator and select Agents from the menu

The Agents page

Click Add Agent

Add Agent

Enter a Name for the agent. This is the name it will be shown as in certdog, so something that identifies the server is a good choice

Certdog Address is the address the agent will use to reach certdog. It is taken from the System URL in Settings. Check that this is an address the agent’s server can reach and that it matches certdog’s TLS certificate. If it is not, correct it here

Leave Auto Approve switched off (recommended). The agent must then be approved after it registers, once its key fingerprint has been checked (step 4 below). If switched on, the agent is approved as soon as it registers with the code, with no fingerprint check

Click Create Code

The registration code

A registration code is displayed, together with the command to run on the agent’s server. Click Copy Command

The registration code:

  • Can be used once, to register one agent
  • Expires after 24 hours
  • Is only displayed once. If it is lost, simply create another

3. Run the Install Script

On the server the agent is being installed on, open a PowerShell window as Administrator and navigate to the folder that was copied in step 1

Paste and run the command that was copied from certdog, e.g.

.\install-certdog-adcs-agent.ps1 -RegistrationCode "CDAG1-eyJ2IjoxLCJ1cmwiOiJodHRwczovL2NlcnRkb2cua3Jlc3RmaWVsZC5jb20vY2VydGRvZy9hcGkiLC..."

The script installs the service, registers the agent with certdog and displays the agent’s key fingerprint:

Certdog ADCS Agent Installation
-------------------------------

Installing the agent from C:\adcs-agent\CertdogAdcsAgent.msi
Service installed OK
Checking the connection to certdog at https://certdog.krestfield.com/certdog/api...
certdog's TLS certificate is trusted by this server
Waiting for the agent...

The agent has registered with certdog.

  KEY FINGERPRINT
  7D31 E09B 4A1C 88F2 0B6D 93E4 5C7A 12FF
  6E08 B4D1 C3A9 7F25 E610 9D4B A852 52AA

It is waiting for approval. In certdog, open Agents, click this agent, and check that the
key fingerprint shown there is the same as the one above. Then click Approve.

Waiting for approval (press Ctrl+C to stop waiting: the agent carries on by itself)...

Leave this window open and move on to the next step

The script has other options, such as running the agent under a service account. See Script Options below

4. Approve the Agent

In certdog, select Agents from the menu. The new agent will be listed with a status of Awaiting Approval. Click the agent to display its details

An agent waiting to be approved

Click Approve

Approve Agent

Compare the key fingerprint displayed with the one displayed by the install script on the agent’s server. They must be the same

This check is what confirms that the agent you are approving is the one you have just installed. Only approve the agent if the fingerprints match

Tick the box to confirm you have compared the fingerprints and click Approve

Back on the agent’s server the script will now display:

The agent is approved and connected to certdog.
It can now be selected on a Microsoft certificate issuer.

The agent is now ready to use. It can be selected when creating a Certificate Issuer. See Create an ADCS Certificate Issuer

TLS Certificates

The agent only connects to a certdog server when both of the following are true:

  1. The server the agent is on trusts certdog’s TLS certificate. That is, the root certificate that the TLS certificate chains to is in the server’s Trusted Root Certification Authorities store (and any intermediate CA certificates are available)
  2. The TLS certificate matches the address the agent is using to connect. E.g. if the agent connects to https://certdog.krestfield.com/certdog/api the certificate must be for certdog.krestfield.com

This check can not be switched off. It is what ensures the agent is talking to your certdog server and not something pretending to be it

If the certificate is not trusted, the agent does not connect. It keeps trying, and will connect by itself once the problem has been resolved. Nothing needs to be re-installed

Recommended: use a certificate your organisation already trusts

Configure certdog with a TLS certificate issued from a CA that your servers already trust, for the name used to access certdog. See Configure Server SSL

The agent will then connect with no further changes, as long as it is using that name to connect. To check or change the address the agent is using see Changing the certdog Address below

The temporary certificate

The temporary certificate created when certdog is installed:

  • Is issued from a root certificate that Windows does not trust: .\certdog\config\sslcerts\tls_root.cer
  • Is only valid for the address 127.0.0.1

This means it can only be used by an agent installed on the certdog server itself, and only once the root certificate has been added to that machine’s Trusted Root Certification Authorities store. The installer offers to do this (see Installing on the certdog Server). It can also be done later by running the following from the .\certdog\agents\adcs-agent directory:

.\configure-certdog-adcs-agent.ps1 -TrustRootCertificate ..\..\config\sslcerts\tls_root.cer

Whether to trust this root certificate is a decision for your organisation. If you prefer not to, do not add it. Configure certdog with your own TLS certificate first and the agent will connect once that is in place

An agent on another server can not use the temporary certificate, as it is not valid for the name or IP address that server would connect to

If the registration has expired

When the agent is installed on the certdog server, the registration that the installer creates for it can be used for 24 hours. If it takes longer than this to configure certdog’s TLS certificate, run .\install-adcs-service.ps1 again from the .\certdog\install directory once the certificate is in place. This registers the agent again

For an agent on another server, create a new registration code in certdog (Agents > Add Agent) and run:

.\configure-certdog-adcs-agent.ps1 -RegistrationCode "CDAG1-....."

Changing the certdog Address

If the address used to access certdog changes (for example, certdog is given a TLS certificate for a host name and the agent was connecting to https://127.0.0.1), tell the agent the new address:

.\configure-certdog-adcs-agent.ps1 -CertdogUrl https://certdog.krestfield.com/certdog/api

The agent keeps its registration and key. It does not need to be approved again

Service Account

The Microsoft CA requires that the certificate requestor has the required permissions on the CA and certificate template in order to be issued with a certificate

See here for details around configuring permissions on the CA and templates

To configure these permissions for the ADCS Agent, you have the following options:

1. Configure a Credential from within Certdog

By default, the ADCS Agent runs as a service (called Krestfield Certdog ADCS Agent) under the LOCAL SYSTEM account. As part of a request, certdog instructs the agent what account to use to access the CA

The account is specified in certdog as a Credential and when creating the Certificate Issuer you select this Credential from the drop down

The account must be a service account (configured with the logon as a service and deny local logon rights, see here) and must have the correct permissions on the CA and template

The password is sent to the agent, over the TLS connection, only with each request that needs it. It is not stored on the agent’s server

2. Configure the ADCS Agent to run under a service account

Alternatively you may configure the ADCS Agent to run under a specific account and configure your Certificate Issuer within certdog to not specify a credential, but to use the account the agent is running under (No Credential (use local agent account))

With this option no password for the CA is held in certdog. A group managed service account (gMSA) is recommended, as it has no password to manage:

.\configure-certdog-adcs-agent.ps1 -ServiceAccount 'INT\gmsa-certdog$'

For a standard domain account, the password must also be provided:

.\configure-certdog-adcs-agent.ps1 -ServiceAccount 'INT\svc-certdog' -ServiceAccountPassword (Read-Host -AsSecureString)

The script grants the account the Log on as a service right. If this is prevented by a group policy, the script will say so and the right must be granted via that policy

The account must have the correct permissions on the CA and template

If the account the agent runs under is changed after the agent has been registered, the agent will need to be registered again. This is because the agent’s key belongs to the account it was created under. See Registering Again below

3. Run under the LOCAL SYSTEM (Computer) account

The final option does not require a specific service account but this will only work correctly if your CA and template are configured to allow the Computer Account (of the server where the agent is running) to obtain certificates

In this case the service remains running under LOCAL SYSTEM and your Certificate Issuer in certdog is configured to use No Credential (use local agent account)

Permissions required at the CA

To do this The account requires
Issue certificates Request Certificates on the CA, and Read and Enroll on the template
Revoke certificates Issue and Manage Certificates on the CA
Approve requests that the CA holds for a CA manager (Approve Pending Requests) Issue and Manage Certificates on the CA
Synchronise certificates from the CA database Issue and Manage Certificates on the CA (the agent only reads from the database)

Managing Agents in Certdog

Select Agents from the menu. All agents are listed, showing the server each is installed on, whether it is approved, whether it is currently connected and its version

Click an agent to display its details

Agent details

This shows the agent’s key fingerprint, the account it runs under, the server’s operating system, what operations it will perform, which Certificate Issuers use it and when it was last connected

  • Approve allows a new agent (or one that was denied) to connect
  • Deny disconnects the agent and stops it from connecting. It remains listed and can be approved again
  • Delete removes the agent from certdog. To use that agent again it must be registered again with a new registration code

The list updates itself every few seconds, so you can watch an agent connect

The Legacy ADCS Drivers tab lists any ADCS Drivers that are registered

Legacy ADCS Drivers

Agents can also be managed with the PowerShell module using Get-RemoteAgents, New-AgentRegistrationCode and Approve-RemoteAgent

Permissions

To manage agents a user must be in a team that has the Global Admin or Automation Manager role. The CA Manager role can view the list of agents, in order to select them for a Certificate Issuer

Checking the Agent

To see what an agent is doing, on the agent’s server open a PowerShell window as Administrator, navigate to the adcs-agent folder and run:

.\configure-certdog-adcs-agent.ps1 -Status

Which will display something like the following:

Service          : Running, runs as LocalSystem
State            : Connected
Message          : Connected to certdog
certdog          : https://certdog.krestfield.com/certdog/api
Agent ID         : 6751a2f0b7c84e1d9a3f5c22
Key fingerprint  : 7D31 E09B 4A1C 88F2 0B6D 93E4 5C7A 12FF
                   6E08 B4D1 C3A9 7F25 E610 9D4B A852 52AA
Agent version    : 1.18.0
Last updated     : 2026-12-03T10:14:55.1827364+00:00
Logs             : C:\ProgramData\Krestfield\CertdogAdcsAgent\logs

Nothing is changed when the script is run with -Status

State will be one of the following:

State Meaning
Connected The agent is connected to certdog and ready for work
WaitingForApproval The agent has registered. An administrator must now approve it in certdog
Registering The agent is trying to register with certdog but has not been able to yet. Message says why. This is displayed while certdog can not be reached or its TLS certificate is not trusted
Disconnected The agent is registered but is not connected at the moment. It keeps trying. Message says why
NotConfigured The agent has been installed but the configure script has not been run
Error Something needs to be put right before the agent can continue. Message says what

Log Files

The agent writes a log file per day to this folder:

C:\ProgramData\Krestfield\CertdogAdcsAgent\logs

Log files are kept for 30 days

Warnings and errors are also written to the Windows Event Log, in the Application log with Source: Certdog ADCS Agent

The log shows when the agent connects and disconnects, each request it processes and whether it succeeded, and the reason for anything that fails

Other files in C:\ProgramData\Krestfield\CertdogAdcsAgent:

File Description
agent.json The agent’s settings: certdog’s address, the agent’s ID and the operations it will perform. This file holds no passwords or keys
status.json What the agent is doing right now. This is what -Status displays
journal.json Results that certdog has not yet acknowledged. Normally empty

This folder can only be read by administrators and by the account the agent runs under

Requests made through the agent are also recorded in certdog’s own logs. See Logs

Troubleshooting

Start by running .\configure-certdog-adcs-agent.ps1 -Status on the agent’s server and looking at the State and Message. Then check the agent’s log file and the Application event log

The agent does not connect: certdog’s TLS certificate is not trusted

The status message, the log and the event log will contain:

certdog's TLS certificate is not trusted by this server, or does not match the host name in the certdog URL. Give certdog a certificate this server trusts, or add its root certificate to this server's Trusted Root Certification Authorities.

Either the root certificate that certdog’s TLS certificate chains to is not trusted by the agent’s server, or the certificate does not match the address the agent is connecting to. See TLS Certificates above

Check which address the agent is using (certdog in the status output). An agent connecting to https://127.0.0.1 will not match a certificate that was issued for a host name. See Changing the certdog Address

Once this is corrected the agent connects by itself

The agent does not connect: certdog can not be reached

The message will say that certdog could not be reached, with the reason (e.g. the connection was refused or timed out, or the name could not be resolved)

  • Check that the certdog service is running
  • Check the address the agent is using is correct
  • Check that the agent’s server can resolve certdog’s name and connect to its HTTPS port. From the agent’s server run: Test-NetConnection certdog.krestfield.com -Port 443
  • Check for firewalls between the agent’s server and certdog. The connection is outbound from the agent to certdog

If certdog has been restricted to certain IP addresses (see Restricting Access to the API), ensure the agent’s server is permitted

The agent keeps trying and connects by itself once certdog can be reached

The agent is waiting for approval

The agent has registered and must be approved in certdog. See Approve the Agent

To obtain the key fingerprint to compare, run .\configure-certdog-adcs-agent.ps1 -Status. The fingerprint is also written to the agent’s log and to the event log when the agent registers

The registration code is refused

A registration code can only be used once and expires after 24 hours. Create a new code in certdog (Agents > Add Agent) and run:

.\configure-certdog-adcs-agent.ps1 -RegistrationCode "CDAG1-....."

The agent has been denied or deleted in certdog

If the agent was denied, an administrator can approve it again from the Agents page

If the agent was deleted, it must be registered again. See Registering Again

The service does not start

If the script reports that the service did not start, check the Windows System event log for entries with Source: Service Control Manager

Event 7041 indicates that the account the service has been configured to run under does not have the Log on as a service right. See here

The agent is connected but requests fail

The error returned to the user (and recorded in the agent’s log) will normally be the message from the CA

  • Access is denied or Denied by Policy Module: the account being used does not have the required permissions on the CA or the template. See Setting Microsoft ADCS Template Permissions and the Service Account section above
  • The RPC server is unavailable: the agent’s server can not reach the CA. Check the Configuration of the Certificate Issuer is correct and that the CA is running. Running certutil -config "server\ca name" -ping on the agent’s server will confirm whether the CA can be reached
  • None of the agents chosen for this are connected and free: no agent selected for the Certificate Issuer is connected. Check the Agents page

The agent does not appear when creating a Certificate Issuer

Only agents that have been approved are listed. Select Agents from the menu and approve the agent

Script Options

configure-certdog-adcs-agent.ps1 can be run at any time to change the agent’s settings. install-certdog-adcs-agent.ps1 accepts the same options and passes them on

Option Description
-RegistrationCode The code from certdog (it starts CDAG1-). If not provided when one is needed, the script will prompt for it
-CertdogUrl The address the agent uses to reach certdog e.g. https://certdog.krestfield.com/certdog/api. Normally not required as the registration code contains the address
-Name The name displayed for the agent in certdog. If not provided, the name entered when the code was created is used
-ServiceAccount The account the service runs under. If not provided the service runs as Local System
-ServiceAccountPassword The password for a domain account, as a secure string. Not required for a gMSA
-TrustRootCertificate A root certificate file (.cer) to add to this server’s Trusted Root Certification Authorities store
-KeyStorage Software (the default) or Tpm. With Tpm the agent’s key is held in the server’s TPM
-DisableSync Do not allow certdog to read the CA’s database. Certificate synchronisation will then not be available through this agent
-Workers How many requests the agent processes at the same time. The default is 5 and should not normally be changed
-ReRegister Register the agent again with a new registration code
-Status Only display what the agent is doing. Nothing is changed

For full details run:

Get-Help .\configure-certdog-adcs-agent.ps1 -Full

Registering Again

An agent must be registered again if:

  • It was deleted in certdog
  • The account the service runs under was changed
  • The server was restored or cloned to different hardware and the agent’s key is held in a TPM

To register again:

  1. In certdog, select Agents. If the agent is still listed, click it and click Delete
  2. Click Add Agent and create a new registration code
  3. On the agent’s server run:
.\configure-certdog-adcs-agent.ps1 -ReRegister -RegistrationCode "CDAG1-....."
  1. Approve the agent in certdog, comparing the key fingerprint as before
  2. For each Microsoft CA Certificate Issuer that used the agent, click Edit, select the agent under Agents and click Update

Upgrading

When certdog is upgraded, upgrade each agent to the same version

The agent on the certdog server

Open a PowerShell window as Administrator, navigate to the .\certdog\install directory of the new version and run:

.\install-adcs-service.ps1

Agents on other servers

Copy the .\certdog\agents\adcs-agent folder from the new version to the server and, from a PowerShell window opened as Administrator, run:

.\install-certdog-adcs-agent.ps1

In both cases the agent keeps its registration, key and settings. No registration code is required and it does not need to be approved again

To check the version of an agent see What Version of Certdog am I Running

Uninstalling

Start Apps and Features. Locate the Certdog ADCS Agent and select Uninstall

Then, in certdog, select Agents, click the agent and click Delete

Migrating from the ADCS Driver

The ADCS Driver and the ADCS Agent can be installed on the same server and run side by side. Each Certificate Issuer uses one or the other, so issuers can be moved across one at a time and moved back if required

After upgrading to version 1.18, existing Microsoft CA Certificate Issuers continue to use the ADCS Driver. Nothing changes until an issuer is switched

To migrate:

  1. Install the agent
    On the certdog server run .\install-adcs-service.ps1 from the .\certdog\install directory (see Installing on the certdog Server). Where the driver is installed on other servers, install the agent on those servers (see Installing on Another Server)

  2. Check the agent is approved and connected
    In certdog, select Agents. The agent should be listed as Approved and Connected

  3. Check the account
    The agent uses the same options as the driver for the account that accesses the CA (see Service Account). If the driver’s service was configured to run under a specific account, configure the agent to run under that same account. If a Credential is configured on the Certificate Issuer, nothing needs to change

  4. Switch each Certificate Issuer
    Select Certificate Issuers, click the Microsoft CA issuer and click Edit. Change Connection from Legacy ADCS driver to ADCS agent, select the agent(s) under Agents and click Update
    See Create an ADCS Certificate Issuer for details of the other settings that are now available

  5. Test
    Request a certificate from the issuer. If there is a problem, the issuer can be switched back to Legacy ADCS driver in the same way

  6. Remove the driver
    Once all Certificate Issuers have been switched and tested, uninstall the driver. Start Apps and Features, locate the Certdog ADCS Driver and select Uninstall. In certdog the driver can then be deleted from the Legacy ADCS Drivers tab of the Agents page

  7. Close the database port
    If port 27017 was opened to allow drivers on other servers to reach the database, and nothing else requires it, it can now be closed. The agent does not use it

What is different

  ADCS Driver (legacy) ADCS Agent
Connects to The certdog database (port 27017) The certdog API over HTTPS (port 443)
Requires .NET Framework 4.8 Nothing. The runtime is included
Trust The database’s TLS certificate certdog’s TLS certificate
Approval Approved in certdog Approved in certdog, after comparing the key fingerprint
Requests requiring CA manager approval Always approved by the driver Approved by the agent, or left for the CA manager (a setting on the issuer)
Certificate synchronisation Via scripts Built in
Service name Krestfield Adcs Driver Krestfield Certdog ADCS Agent
Event log source CertdogAdcsDriver Certdog ADCS Agent