> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/gateway/guides/certificates/windows-certificate-store.md). Agents can also search and read this documentation through its [MCP server](https://docs.devolutions.net/~gitbook/mcp).

# Use the Windows certificate store

Load the Devolutions Gateway TLS certificate from the Windows certificate store, grant private key access, and renew it without restarting.

On Windows, Devolutions Gateway can load its TLS certificate from the Windows certificate store instead of a file. Your certificates stay managed by Windows (auto-enrollment, renewal, non-exportable keys), and Devolutions Gateway uses a renewed certificate with the same subject name without a service restart. The Windows certificate store isn't available on Linux or in Docker: there, Devolutions Gateway stops with "system certificate store not supported for this platform".

## How Devolutions Gateway picks the certificate

<table><thead><tr><th width="280">SETTING IN gateway.json</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong><code>TlsCertificateSource</code></strong></td><td><code>System</code> to use the Windows certificate store. <code>External</code> (default) uses the certificate files in <code>TlsCertificateFile</code> and <code>TlsPrivateKeyFile</code>. When the source is <code>System</code>, the file keys are ignored and can stay in the file.</td></tr><tr><td><strong><code>TlsCertificateSubjectName</code></strong></td><td>Subject name of the certificate to use, for example <code>gateway.contoso.com</code>. Required with <code>System</code>: "TLS usage implied, but TLS certificate subject name is missing".</td></tr><tr><td><strong><code>TlsCertificateStoreName</code></strong></td><td>Store name. Default: <code>My</code> (the <em><strong>Personal</strong></em> store).</td></tr><tr><td><strong><code>TlsCertificateStoreLocation</code></strong></td><td><code>LocalMachine</code>, <code>CurrentUser</code> (default when the key is absent) or <code>CurrentService</code>. Use <code>LocalMachine</code>: <code>CurrentUser</code> is the profile of the account the service runs as (NETWORK SERVICE by default), not the profile of the administrator who imports the certificate.</td></tr></tbody></table>

Among the certificates of that store whose subject matches `TlsCertificateSubjectName`, Devolutions Gateway:

1. Skips certificates that aren't valid yet.
2. Skips certificates without the Server Authentication EKU or without a Subject Alternative Name, when `TlsVerifyStrict` is `true`.
3. Uses the certificate that expires last and whose private key it can read.

When no certificate qualifies, the service logs "no usable certificate found in the system store; observed issues: …" and writes event 3006 "No usable certificate found".

The selection is repeated during TLS connections and cached about 45 seconds. When you import a renewed certificate with the same subject name, Devolutions Gateway starts using it within a minute, without a restart.

## Import the certificate in the Windows certificate store

Devolutions Gateway needs the certificate **with its private key**. Import a `.pfx` or `.p12` file. If you have a `.crt` or `.cer` file and a separate `.key` file, combine them first:

* With the Windows `certutil` tool: give both files the same name (for example `gateway.crt` and `gateway.key`) and run `certutil -MergePFX gateway.crt gateway.pfx`.
* With Remote Desktop Manager: create an ***X.509 Certificate*** entry (***New Entry*** – ***Credential Management*** – ***X.509 Certificate***) with the certificate and its private key, then use ***Save Certificate As*** with the ***Personal Information Exchange (pfx)*** export format.

Then import it in the local computer store:

1. Run `certlm.msc` (***Certificates - Local Computer***).
2. Right-click ***Personal*** – ***Certificates*** and select ***All Tasks*** – ***Import***.
3. Select the `.pfx` file, enter its password, and finish the wizard with ***Place all certificates in the following store*** – ***Personal***.

Make sure the intermediate certificates are present on the machine (in the file you import, or in ***Intermediate Certification Authorities***), so that Devolutions Gateway can send the full chain to clients.

## Give the service account read access to the private key

The service account must be able to read the private key. The default account is NETWORK SERVICE; on installations that use another account, see [Install on Windows](https://docs.devolutions.net/gateway/for-administrators/install/windows.md).

The Windows installer grants this access by itself when the certificate is selected in `LocalMachine`, including at upgrades when the service account changes. To grant it manually:

1. In `certlm.msc`, right-click the certificate and select ***All Tasks*** – ***Manage Private Keys***.
2. Click ***Add***, enter `NETWORK SERVICE` (or the service account, for example `NT SERVICE\DevolutionsGateway`) and click ***OK***.
3. Select the account, allow ***Read***, and click ***OK***.

The Windows installer warns "The {account} account may not have permission to read the certificate's private key. The installer will attempt to grant the required access." when it detects the account can't read the key.

## Configure Devolutions Gateway

### When installing

* **Windows installer:** in the ***Certificate*** page, set ***Certificate Source*** to ***System***, choose ***Store Location*** ***Local Machine*** and the ***Certificate Store***, then search and select the certificate. New selections in ***Current User*** are refused by the installer.
* **Devolutions Server Console:** in ***Certificate configuration***, fill in ***Certificate store location***, ***Certificate store name*** and ***Certificate subject name***, or use ***Select certificate...***. See [Install Devolutions Gateway from the Devolutions Server Console](https://docs.devolutions.net/gateway/guides/devolutions-server/install-from-console.md).

### In gateway.json

1. Open `%ProgramData%\Devolutions\Gateway\gateway.json` in an editor run as administrator.
2. Set the certificate keys and keep an `https` listener, for example:

```json
{
  "Id": "<keep your existing ID>",
  "Hostname": "gateway.contoso.com",
  "ProvisionerPublicKeyFile": "provisioner.pem",
  "TlsCertificateSource": "System",
  "TlsCertificateSubjectName": "gateway.contoso.com",
  "TlsCertificateStoreName": "My",
  "TlsCertificateStoreLocation": "LocalMachine",
  "TlsVerifyStrict": true,
  "Listeners": [
    { "InternalUrl": "https://*:7171", "ExternalUrl": "https://*:7171" },
    { "InternalUrl": "tcp://*:8181", "ExternalUrl": "tcp://*:8181" }
  ]
}
```

3. Check that the file is valid JSON before restarting:

```powershell
Get-Content "$Env:ProgramData\Devolutions\Gateway\gateway.json" -Raw | ConvertFrom-Json | Out-Null
```

4. Restart the service: `Restart-Service DevolutionsGateway`.

### With PowerShell

```powershell
Import-Module DevolutionsGateway
Set-DGatewayConfig -TlsCertificateSource System -TlsCertificateSubjectName 'gateway.contoso.com' -TlsCertificateStoreLocation LocalMachine -TlsCertificateStoreName My
Restart-DGateway
```

{% hint style="warning" %}
`Set-DGatewayConfig` rewrites `gateway.json` and removes the keys the module doesn't know, including `TlsVerifyStrict`. Add `"TlsVerifyStrict": true` back after running it. See [Manage Devolutions Gateway with PowerShell](https://docs.devolutions.net/gateway/for-administrators/powershell.md).
{% endhint %}

## Verify

1. Open `https://gateway.contoso.com:7171/jet/health` in a browser. The page shows `Devolutions Gateway "<host name>" is alive and healthy.` and the browser trusts the certificate.
2. In the Application log of the Event Viewer, source ***Devolutions Gateway***, look for event 3000 "TLS configured" with the source `system`.

## If it doesn't work

* **Event 3006 "No usable certificate found":** the subject name doesn't match, the certificate isn't valid yet, it has no Server Authentication EKU or SAN while `TlsVerifyStrict` is `true`, or the service account can't read the private key.
* **The certificate works for some clients only:** the chain is incomplete on the machine. Import the intermediate certificates.
* More checks: [Devolutions Gateway troubleshooting](https://docs.devolutions.net/gateway/help/troubleshooting/general.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/gateway/guides/certificates/windows-certificate-store.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
