# Certificate Manager best practices

A certificate stops protecting traffic on the day it expires, and an automatic renewal fails once the record that proves control of the domain is gone. A private key or a DNS credential that reaches too far turns one leak into exposure of every name it covers.

These practices apply to the certificates that [Certificate Manager](/en/documentation/platform/certificate-manager/), a Platform Resource, stores for a [Workload](/en/documentation/platform/workloads/). In order, they are: replace a server certificate before it expires, keep the challenge record of a domain hosted outside Edge DNS, choose a domain-validated certificate unless you need more, limit DNS-01 credentials to the challenge records, and keep wildcard certificates off critical production systems.

Binding a certificate changes the Workload, and that change takes several minutes to reach all of Azion's distributed infrastructure, with no guaranteed duration. Until then, requests can meet the old or the new configuration, so a check on this page holds only once repeated requests agree. For more information, refer to [Propagation](/en/documentation/platform/workloads/how-it-works/#propagation).

---

## Replace a server certificate before it expires

An uploaded server certificate never renews itself, and once its `validity` date passes, it no longer protects traffic. Switching while the old certificate is still valid leaves time to confirm the new one and to switch back if it fails. The cost is the old entry, which stays in Certificate Manager until you delete it.

Azion renews the Let's Encrypt certificates it manages, as [Renewal](/en/documentation/platform/certificate-manager/issuance-and-renewal/#renewal) describes, so this practice covers the certificates you upload. After you upload the new certificate, point `tls.certificate` at its ID with this body for `azion update workload --file`:

```json
{
"id": <workload-id>,
"tls": { "certificate": <new-certificate-id>, "ciphers": 7, "minimum_version": "tls_1_3" }
}
```

Replace `7` and `tls_1_3` with the `ciphers` and `minimum_version` values the Workload already holds, so that the certificate is the only value that changes. The CLI answers `Updated Workload with ID <workload-id>`.

To check, run `azion list digital-certificate --details`: the new certificate reads `active`, and the old one reads `inactive` once no Workload uses it. Delete the old entry after the new one reads `active` and the change has propagated. For the upload itself, refer to [Upload a digital certificate](/en/documentation/guides/application-security/tls-and-certificates/digital-certificates/).

---

## Keep the challenge record of a domain hosted outside Edge DNS

Azion renews a managed Let's Encrypt certificate before it expires by running its challenge again. For a DNS-01 certificate whose zone is in [Edge DNS](/en/documentation/platform/edge-dns/), Azion writes the `_acme-challenge` record itself. At another DNS provider, the challenge depends on a record you added, and deleting that record makes the next renewal fail, so the certificate expires.

The record is a canonical name (CNAME) record named `_acme-challenge.<your-domain>` that points to `<your-domain>.letsencrypt.azion.com`. Keep it at your provider for as long as a Workload uses the certificate.

Renewal starts 30 days before the 90-day validity ends. To check, confirm before then that the CNAME still exists and that the certificate's status in Certificate Manager is not `failed`. For the record to create, refer to [Request a Let's Encrypt certificate](/en/documentation/guides/application-security/tls-and-certificates/how-to-generate-a-lets-encrypt-certificate/).

---

## Choose a domain-validated certificate unless you need more

The certificate authority (CA) that issues a certificate you upload validates the request at one of three levels:

- Domain Validation (DV) confirms your right to use the domain.
- Organization Validation (OV) adds checks on the requesting organization.
- Extended Validation (EV) asks for documents that prove the organization's physical, legal, and operational existence.

Use DV in most cases. OV and EV take more work to obtain, and their extra checks vouch for your organization rather than for the domain. Order OV or EV only when a requirement you can name asks for those checks. For the three levels, refer to [Validation levels](/en/documentation/platform/certificate-manager/certificates/#validation-levels).

---

## Limit DNS-01 credentials to the challenge records

This practice applies when your own Automatic Certificate Management Environment (ACME) client, such as Certbot, obtains a certificate for a zone outside Edge DNS. A Let's Encrypt certificate that Azion manages needs none of it, because the single CNAME of [Keep the challenge record of a domain hosted outside Edge DNS](/en/documentation/platform/certificate-manager/best-practices/#keep-the-challenge-record-of-a-domain-hosted-outside-edge-dns) is enough.

Your ACME client writes the `_acme-challenge` record at the DNS provider, so it holds the provider's API credentials. Credentials that reach every record give whoever obtains them control of the domain and of all its records.

Restrict those credentials to `_acme-challenge` records, so that a leak exposes only the challenge. The cost is a separate credential that you create and keep for that client alone. To check, confirm at your provider that the credential's permissions name only `_acme-challenge` records.

---

## Keep wildcard certificates off critical production systems

A wildcard certificate, such as one for `*.example.com`, covers subdomains such as `blog.example.com` with a single private key. When that key leaks, or the certificate is revoked, every subdomain it covers is affected at once. A wildcard certificate fits when:

- Centralized management is a priority.
- The same team manages the subdomains.
- A well-defined reverse proxy architecture exists.
- Your security policies allow controlled key sharing.

Under stricter requirements, give each critical production system a certificate of its own, keep separate certificates for development environments, and leave the wildcard to lower-criticality services. The cost is one replacement per certificate instead of one replacement for all. For how Azion issues a wildcard name, refer to [Wildcard certificates](/en/documentation/platform/certificate-manager/issuance-and-renewal/#wildcard-certificates).

Keep a wildcard's private key in Certificate Manager, bound to Workloads, instead of copying it across servers. Once saved, the key cannot be read back from Azion Console or the API.

To check, list the Workloads that use each wildcard certificate with `GET /v4/workspace/workloads?digital_certificate_id=<certificate-id>`, and give any critical production Workload a certificate of its own.

---

## Related resources

- [Certificates](/en/documentation/platform/certificate-manager/certificates.md): The certificate types, statuses, and validation levels behind these practices.
- [Issuance and renewal](/en/documentation/platform/certificate-manager/issuance-and-renewal.md): How Let's Encrypt validates and issues a certificate that Azion requests, how Azion renews it, and when Azion stops renewing it.
- [How Certificate Manager works](/en/documentation/platform/certificate-manager/how-it-works.md): How a Workload binds each certificate, and why the certificate and the Workload are checked apart.
- [Troubleshoot Certificate Manager](/en/documentation/platform/certificate-manager/troubleshooting.md): Symptoms of a certificate that stays pending, fails to issue, or is refused, for when a practice was skipped.
