# Troubleshoot Certificate Manager

These symptoms affect [Certificate Manager](/en/documentation/platform/certificate-manager/), the Platform Resource that stores the certificates a Workload uses for Transport Layer Security (TLS) and reports each one's state in its `status` field. They cover a Let's Encrypt certificate that does not issue, and a request or an upload that the API refuses. A certificate refused in a Workload setting is a Workload symptom, under [Troubleshoot Workloads](/en/documentation/platform/workloads/troubleshooting/#a-certificate-is-refused-in-a-workload-setting). For where Certificate Manager acts on a request, refer to [Request path](/en/documentation/platform/certificate-manager/#request-path).

---

## A certificate stays pending

A Let's Encrypt certificate does not leave the `pending` or `challenge_verification` status. In Azion Console, the Workload's **Digital Certificate** field warns "This certificate is pending validation and HTTPS may not work until it’s validated".

One of the names fails its challenge: in HTTP-01, Let's Encrypt fetches a file from each hostname, so every name must point to Azion. In DNS-01, it reads an `_acme-challenge` record in the domain's DNS, as [Domain validation](/en/documentation/platform/certificate-manager/issuance-and-renewal/#domain-validation) explains.

- **Check the names**: a certificate requested from the Workload form in Azion Console covers the Workload's **Domains**, so confirm that each one is correct.
- **Point every name at Azion for HTTP-01**, alternative names included.
- **Add the CNAME for DNS-01 at another DNS provider**: name it `_acme-challenge.<your-domain>`, with the value `<your-domain>.letsencrypt.azion.com`. In Edge DNS, Azion writes the record itself.
- **Check the CNAME records again if the certificate keeps failing**: Azion retries a failed issuance at increasing intervals, as [Issuance time and retries](/en/documentation/platform/certificate-manager/issuance-and-renewal/#issuance-time-and-retries) lists.

After a later attempt validates, the certificate reads `active` while a Workload uses it, or `inactive` until then. For the records step by step, refer to [Request a Let's Encrypt certificate](/en/documentation/guides/application-security/tls-and-certificates/how-to-generate-a-lets-encrypt-certificate/).

---

## A certificate request is refused with This account cannot use certain common or alternative names

A Let's Encrypt request, a certificate signing request (CSR), or saving a new domain in Azion Console fails with `This account cannot use certain common or alternative names because it does not have permission for their domain names.`

The request carries a name in a domain that the account has no permission for. An `azion.app` hostname is refused too, even one that a Workload of the account holds, as [Errors](/en/documentation/platform/certificate-manager/certificates/#errors) lists.

- **Name only hostnames in domains your account has permission for**, in `common_name` and `alternative_names`.
- **Request no certificate for an `azion.app` hostname**: with `tls.certificate` set to `null`, the Workload presents the Azion SAN certificate, which covers the `azion.app` hostname and the workload domain.
- **Remove the refused domain from Domains in Azion Console**: adding a domain switches **Digital Certificate** from *Azion (SAN)* to *New Let's Encrypt Certificate (DNS-01)*. **Save** then requests that certificate before it saves the Workload, and saves nothing when the request is refused.

An accepted request returns the certificate's `id` with the `pending` status, and Azion Console shows "Your workload has been updated".

---

## A certificate fails to issue

A Let's Encrypt certificate reads `failed`. In Azion Console, the Workload's **Digital Certificate** field warns "This digital certificate failed and HTTPS cannot be used until the issue is resolved".

Validation failed, and Azion stores the reason in the certificate's `status_detail` field. One value names the hostname whose record to check:

```text
An error has occurred while issuing the requested certificate. Please verify the following domains CNAME: www.example.com
```

Another value names no hostname, so check every name on the certificate, as [A certificate stays pending](/en/documentation/platform/certificate-manager/troubleshooting/#a-certificate-stays-pending) lists:

```text
domain ownership validation failed - verify DNS records or HTTP challenge accessibility
```

Read `status_detail` from any interface, then correct the record or the name it points to:

- **Azion Console**: in **Certificate Manager**, the error icon of the certificate carries it.
- **Azion CLI**: `azion describe digital-certificate --digital-certificate-id <certificate-id> --format json` prints it beside `status`.
- **API**: `GET /v4/workspace/tls/certificates/<certificate-id>` returns it with the certificate.

A later attempt in the [retry schedule](/en/documentation/platform/certificate-manager/issuance-and-renewal/#issuance-time-and-retries) can then issue the certificate, and an issued certificate in use reads `active`, with `status_detail` at `""`.

---

## An uploaded private key is refused

Uploading a server certificate fails with `The provided private key is invalid. Please check the key and try again.`

The `private_key` that arrived with the certificate is not one the API can read, as [Errors](/en/documentation/platform/certificate-manager/certificates/#errors) lists.

- **Send the key that matches the certificate**.
- **Send the key in PEM**, with its `-----BEGIN` and `-----END` lines and no passphrase, as [Key algorithms and formats](/en/documentation/platform/certificate-manager/certificates/#key-algorithms-and-formats) lists.
- **Write the key as one JSON string in an API body**, with each line break written as `\n`.

Azion CLI then prints `Created Digital Certificate with ID <certificate-id>`, and the certificate reads `inactive` until a Workload uses it.

---

## Related resources

- [Certificates](/en/documentation/platform/certificate-manager/certificates.md#errors): The certificate types, statuses, and key formats, with every error an upload or a request returns.
- [Issuance and renewal](/en/documentation/platform/certificate-manager/issuance-and-renewal.md): How each challenge validates a name, and the schedule Azion follows when an attempt fails.
- [Upload a digital certificate](/en/documentation/guides/application-security/tls-and-certificates/digital-certificates.md): The steps to upload a server certificate with its private key and bind it to a Workload.
- [Certificate Manager best practices](/en/documentation/platform/certificate-manager/best-practices.md): Keep the challenge record in place and replace an uploaded certificate before it expires.
